我在 asp 中有注册表单,它有 30 个输入框,它们都有 RequiredFieldValidator 。当用户单击提交时,我如何发现至少有一个输入未填写并在提交按钮和输入控件旁边显示错误?
<fieldset>
<legend>title :</legend>
<asp:Table ID="Table3" runat="server">
<asp:TableRow runat="server">
<asp:TableCell runat="server"> :</asp:TableCell>
<asp:TableCell runat="server">
<asp:TextBox ID="txtMadrakTahsili" runat="server" CssClass="Width"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ErrorMessage="*" Display="Dynamic" ControlToValidate="txtMadrakTahsili"></asp:RequiredFieldValidator>
</asp:TableCell>
<asp:TableCell runat="server">reshte :</asp:TableCell>
<asp:TableCell runat="server">
<asp:TextBox ID="txtReshteTahsili" runat="server" CssClass="Width"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator25" runat="server"
ErrorMessage="*" Display="Dynamic" ControlToValidate="txtReshteTahsili"></asp:RequiredFieldValidator></asp:TableCell>
<asp:TableCell ID="TableCell7" runat="server">mahale akhz :</asp:TableCell>
<asp:TableCell ID="TableCell8" runat="server">
<asp:TextBox ID="txtMahalAkhzMadrak" runat="server" CssClass="Width"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server"
ErrorMessage="*" Display="Dynamic" ControlToValidate="txtMahalAkhzMadrak"></asp:RequiredFieldValidator></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">avg</asp:TableCell>
<asp:TableCell runat="server">
<asp:TextBox ID="txtMoadel" runat="server" CssClass="Width"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server"
ErrorMessage="*" Display="Dynamic" ControlToValidate="txtMoadel"></asp:RequiredFieldValidator></asp:TableCell>
</asp:TableRow>
</asp:Table>
</fieldset>
如果一个 og 输入未填写,则在此按钮旁边显示错误!
<p style="float:left; clear:both;">
<asp:Button ID="Button1" runat="server" Text="ثبت اطلاعات" Height="54px"
style="margin-right: 0" Width="119px" onclick="Button1_Click" /></p>