asp.net Textbox服务器控件

复制代码 代码如下:


   

   


        姓名:
       

       

        性别:
           
           
       

        密码:
       

        移动电话:            ontextchanged="TextBox3_TextChanged">
       

        简介:

       
       

       

                    ImageUrl="~/img/QQ截图20130909140346.png" Width="72px" />
       

       

       

       

       


   

   



textChange的事件代码如下:

复制代码 代码如下:

protected void txtNum2_TextChanged(object sender, EventArgs e)
    {
        if (txtNum2.Text.Length == 0)
        {
            //Page.RegisterClientScriptBlock("","");
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "");
            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 = "偶数";
                }
                else
                {
                    txtSum.Text = "奇数";
                }
            }
        }
    }
}

你可能感兴趣的:(asp.net Textbox服务器控件)