2013-07-03 60 views

回答

0

將ValidationGroup =「set1」和ValidationGroup =「set2」屬性添加到您的文本框,按鈕,驗證程序和驗證摘要中,應該這樣做。

+0

驗證組在ASP 1.1中不起作用 – user2545231

0

您必須爲每組文本框和按鈕設置相同的組名稱。

<asp:TextBox ID="TextBox1" runat="server" ValidationGroup="GroupOne"></asp:TextBox> 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"   
ControlToValidate="TextBox1" 
ErrorMessage="ErrorMessageForTextBox1" ValidationGroup="GroupOne"> 
</asp:RequiredFieldValidator> 

<asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="GroupOne" /> 

<asp:TextBox ID="TextBox2" runat="server" ValidationGroup="GroupTwo"></asp:TextBox> 
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"   
ControlToValidate="TextBox2" 
ErrorMessage="ErrorMessageForTextBox1" ValidationGroup="GroupTwo"> 
</asp:RequiredFieldValidator> 

對於ASP 1.1版本,使用該link