欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net Textbox服務(wù)器控件

 更新時(shí)間:2013年09月09日 14:55:55   作者:  
這篇文章介紹了asp.net Textbox服務(wù)器控件的簡(jiǎn)單實(shí)例,有需要的朋友可以參考一下

復(fù)制代碼 代碼如下:

<body>
    <form id="form1" runat="server">
    <div>

        姓名:<asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
        <br />
        <br />
        性別:<asp:RadioButtonList ID="rblsex" runat="server">
            <asp:ListItem>男</asp:ListItem>
            <asp:ListItem>女</asp:ListItem>
        </asp:RadioButtonList>
        密碼:<asp:TextBox ID="txtPwd" runat="server" TextMode="Password"></asp:TextBox>
        <br />
        移動(dòng)電話:<asp:TextBox ID="txttel" runat="server"
            ontextchanged="TextBox3_TextChanged"></asp:TextBox>
        <br />
        簡(jiǎn)介:<br />
        <asp:TextBox ID="txtinfo" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:ImageButton ID="ImageButton1" runat="server" Height="58px"
            ImageUrl="~/img/QQ截圖20130909140346.png" Width="72px" />
        <br />
        <br />
        <br />
        <br />
        <br />

    </div>
    </form>
</body>


textChange的事件代碼如下:

復(fù)制代碼 代碼如下:

protected void txtNum2_TextChanged(object sender, EventArgs e)
    {
        if (txtNum2.Text.Length == 0)
        {
            //Page.RegisterClientScriptBlock("","<script>alert('請(qǐng)輸入一個(gè)數(shù)');</script>");
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('請(qǐng)輸入一個(gè)數(shù)');</script>");
            txtNum2.Focus();
        }
        else
        {
            int result;
            bool n1 = Information.IsNumeric(txtNum2.Text.Trim());
            if (n1)
            {
                result = int.Parse(txtNum2.Text.Trim()) % 2;
                if (result == 0)
                {
                    txtSum.Text = "偶數(shù)";
                }
                else
                {
                    txtSum.Text = "奇數(shù)";
                }
            }
        }
    }
}

相關(guān)文章

最新評(píng)論