asp.net Textbox服務(wù)器控件
更新時(shí)間:2013年09月09日 14:55:55 作者:
這篇文章介紹了asp.net Textbox服務(wù)器控件的簡單實(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 />
移動電話:<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的事件代碼如下:
復(fù)制代碼 代碼如下:
protected void txtNum2_TextChanged(object sender, EventArgs e)
{
if (txtNum2.Text.Length == 0)
{
//Page.RegisterClientScriptBlock("","<script>alert('請輸入一個(gè)數(shù)');</script>");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('請輸入一個(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ù)";
}
}
}
}
}
您可能感興趣的文章:
- asp.net 簡便無刷新文件上傳系統(tǒng)
- Asp.Net超大文件上傳問題解決
- Asp.Net 無刷新文件上傳并顯示進(jìn)度條的實(shí)現(xiàn)方法及思路
- asp.net實(shí)現(xiàn)上傳文件顯示本地絕對路徑的實(shí)例代碼
- ASP.NET MVC處理文件上傳的小例子
- asp.net 文件上傳實(shí)例匯總
- asp.net文件上傳示例分享
- ASP的chr(0)文件上傳漏洞原理和解決方法介紹
- asp.net fileupload控件上傳文件與多文件上傳
- ASP.NET實(shí)現(xiàn)的簡單易用文件上傳類
- ASP.NET對大文件上傳的解決方案
- asp.net批量多選文件上傳解決方案
- ASP.NET設(shè)計(jì)FTP文件上傳的解決方案
- asp將本地的文件上傳到服務(wù)器
相關(guān)文章
輕量級ORM框架Dapper應(yīng)用之實(shí)現(xiàn)In操作
這篇文章介紹了使用Dapper實(shí)現(xiàn)In操作的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-03-03
Asp.net TextBox的TextChanged事件使用介紹
動態(tài)創(chuàng)建的控件是如何加載視圖狀態(tài),還提到ProcessPostData方法的調(diào)用,這里我就用TextBox的TextChanged事件來說說視圖數(shù)據(jù)的加載以及事件的觸發(fā)2012-12-12
SQLServer 在Visual Studio的2種連接方法
這篇文章介紹了SQLServer 在Visual Studio的2種連接方法,有需要的朋友可以參考一下2013-09-09
aspnet?core使用websocket實(shí)時(shí)更新商品信息的方法
這篇文章主要介紹了aspnetcore使用websocket實(shí)時(shí)更新商品信息,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2024-01-01

