Copy Code code as follows:
<body>
<form id= "Form1" runat= "Server" >
<div>
Name: <asp:textbox id= "Txtuser" runat= "Server" ></asp:TextBox>
<br/>
<br/>
Sex: <asp:radiobuttonlist id= "Rblsex" runat= "Server" >
<asp:ListItem> male </asp:ListItem>
<asp:ListItem> Women </asp:ListItem>
</asp:RadioButtonList>
Password: <asp:textbox id= "txtpwd" runat= "Server" textmode= "Password" ></asp:TextBox>
<br/>
Mobile: <asp:textbox id= "Txttel" runat= "Server"
Ontextchanged= "Textbox3_textchanged" ></asp:TextBox>
<br/>
Introduction: <br/>
<asp:textbox id= "Txtinfo" runat= "Server" ></asp:TextBox>
<br/>
<br/>
<asp:imagebutton id= "ImageButton1" runat= "Server" height= "58px"
Imageurl= "~/img/qq screenshot 20130909140346.png" width= "72px"/>
<br/>
<br/>
<br/>
<br/>
<br/>
</div>
</form>
</body>
The TextChange event code is as follows:
Copy Code code as follows:
protected void Txtnum2_textchanged (object sender, EventArgs e)
{
if (txtNum2.Text.Length = 0)
{
Page.registerclientscriptblock ("", "<script>alert (' Please enter a number ');</script>");
Page.ClientScript.RegisterClientScriptBlock (this. GetType (), "", "<script>alert (' Please enter a number ');</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 = "even";
}
Else
{
txtSum.Text = "odd number";
}
}
}
}
}