• textbox 只能输入数字 不为空


    <asp:TextBox ID="txtPageNum" runat="server" CssClass="txtInput2 small2" AutoPostBack="True"
                    OnTextChanged="txtPageNum_TextChanged" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)));" >10</asp:TextBox>
                <asp:RegularExpressionValidator ID="revEnterNum" runat="server" ControlToValidate="txtPageNum"
                    Display="Dynamic" ErrorMessage="请输入数字!" ValidationExpression="^([1-9][0-9]*)$"></asp:RegularExpressionValidator>
                <asp:RequiredFieldValidator ID="rfvNotEmpty" runat="server" ControlToValidate="txtPageNum"
                    Display="Dynamic" ErrorMessage="不能为空,请输入数字!"></asp:RequiredFieldValidator>
     ////设置分页数量
        protected void txtPageNum_TextChanged(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
              AspNetPager1.CurrentPageIndex = 1;
              AspNetPager1.PageSize = Convert.ToInt32(txtPageNum.Text.Trim());
              RptBind();
            }
        }
  • 相关阅读:
    bzoj2763: [JLOI2011]飞行路线(分层图spfa)
    8.20noip模拟题
    8.19noip模拟题
    1046: [HAOI2007]上升序列(dp)
    bzoj1079: [SCOI2008]着色方案(dp)
    逆序对
    P1966 火柴排队(逆序对)
    NOIP 2015 DAY2
    8.15学校模拟
    差分
  • 原文地址:https://www.cnblogs.com/LifeKingcn/p/2752201.html
Copyright © 2020-2023  润新知