ASP中验证控件,异步

<%--ValidationSummary 对当前页面的提示信息的收集控件 DisplayMode 展示的样式 ShowSummary 是否显示--%>

    <asp:ValidationSummary DisplayMode="BulletList" ShowSummary="true" runat="server" />
    <% ScriptManager 脚本管理%>
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    <% UpdatePanel 可异步更新的所有控件,包括触发控件 %>
    <asp:UpdatePanel runat="server">
    <!-- ContentTemplate 内容模板-->
    <ContentTemplate>
    <asp:CheckBox ID="CheckBox1" runat="server" />
    <% CausesValidation 验证自动触发  AutoPostBack 自动回传 ,触发控件%>
    <asp:TextBox ID="TextBox1" runat="server" CausesValidation="True"> 
            OnTextChanged="TextBox1_TextChanged" AutoPostBack="True"></asp:TextBox>
    <asp:TextBox ID="txtBox1" runat="server"></asp:TextBox>
    <%  ControlToValidate 验证的控件Id  ErrorMessage 显示在控件的右侧 %>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtBox1" Text="!" ErrorMessage="!!!!!111bu neng wei kong"></asp:RequiredFieldValidator>
    <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="TextBox1" Text="!" ErrorMessage="!!!!!222bu neng wei kong"></asp:RequiredFieldValidator>
    
    </ContentTemplate>
    <%  Triggers 触发器 %>
    <Triggers>
    <%  ControlID设置使用触发器的控件 %>
        <asp:AsyncPostBackTrigger ControlID="TextBox1" />
    </Triggers>
    </asp:UpdatePanel>
    <asp:Button ID="btn1" runat="server" CausesValidation="true" Text="submit" OnClick="btn1_Click" />

你可能感兴趣的:(server,脚本,asp,button,textbox,triggers)