在下面的代码中,提交按钮具有'SubmitValidation'ValidationGroup。
当我在RequiredFieldValidator中更改ValidationGroup的名称(to submitValidation123)时,不会出现错误消息“输入状态代码”(如预期的那样)。但是,在我实际输入州代码的值之前,提交不会发生。为什么?
<tr>
<td>
<span class="requiredText">*</span> State Code (Ex. TX):
</td>
<td>
<asp:TextBox runat="server" ID="statecodeTxt" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator ID="statecodeRFV" runat="server"
Display="Dynamic" ValidationGroup="submitValidation"
ControlToValidate="statecodeTxt" SetFocusOnError="True"
ErrorMessage="Enter State Code" />
</td>
</tr>
<asp:Button ID="submitBtn" Text="Submit" disabled="true"
runat="server" ValidationGroup="submitValidation"
OnClick="submitBtn_Click" />
答案 0 :(得分:0)
尝试删除或伪造 SetFocusOnError = “真”