asp.net Textbox服务器控件
2013-09-09 00:00
429 查看
<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 /> 移动电话:<asp:TextBox ID="txttel" runat="server" ontextchanged="TextBox3_TextChanged"></asp:TextBox> <br /> 简介:<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的事件代码如下:
protected void txtNum2_TextChanged(object sender, EventArgs e) { if (txtNum2.Text.Length == 0) { //Page.RegisterClientScriptBlock("","<script>alert('请输入一个数');</script>"); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('请输入一个数');</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 = "偶数"; } else { txtSum.Text = "奇数"; } } } } }
相关文章推荐
- asp.net如何隐藏服务器控件TEXTBOX
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- 关于form表单中禁用所有Asp.net 服务器控件TextBox的方法
- 学习笔记:ASP.NET TextBox 服务器控件源码
- ASP.NET中遍历所有TextBox服务器控件
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- ASP.net 自定义服务器控件 TextBox
- Asp.net 学习 -服务器控件 -TextboxData
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- 教学思路ASP.Net之服务器控件:一、Label、TextBox、HyperLink、三种Button控件
- asp.net Textbox服务器控件
- ASP.NET - TextBox Web 服务器控件概述
- 教学思路ASP.Net之服务器控件:一、Label、TextBox、HyperLink、三种Button控件
- ASP.NET中服务器控件Button调用javascript代码运用正则表达式验证TextBox中输入的是否为正整数或正小数,符合要求则继续运行服务器端代码功能的实现
- asp.net textbox等服务器控件包含html代码的时候,提交会报错
- Asp.net中TextBox控件内容更改后无法POST到服务器
- ASP.NET 2.0中TextBox服务器控件的ReadOnly和Disabled属性
- ASP.NET自定义Web服务器控件-TextBox文本框控件