asp.net Textbox服务器控件

发布时间:2022-04-16 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了asp.net Textbox服务器控件脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

复制代码 代码如下:

<body>
&nbsp;   <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 Textbox服务器控件所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:asp.net