如果控件被禁用,则 requiredfield 验证器不应验证
我有两个控件,因为我已经为该控件设置了所需的字段验证器。我的问题是暂时我已将这两个控件设置为禁用,但此所需的验证器正在检查这两个控件是否处于禁用模式。我正在检查单击“保存”按钮时需要字段验证器。如何克服这个问题?
<asp:DropDownList ID="DropDownList1" Width="150" runat="server" TabIndex="17" Enabled="false"
AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="--Select Company--"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="DropDownList1"
ValidationGroup="UserDetailsGroup" InitialValue="--Select Company--" ErrorMessage="*"></asp:RequiredFieldValidator>
texboxcontrol:
<asp:TextBox ID="AcquiredDate" runat="server" Width="150" TabIndex="18" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="AcquiredDate"
ValidationGroup="UserDetailsGroup" ErrorMessage="*"></asp:RequiredFieldValidator>
这里的保存按钮是图像按钮?
<asp:ImageButton ID="Save" runat="server" ImageUrl="~/Images/save-button.gif"
OnClick="Save_Click" TabIndex="41" ValidationGroup="UserDetailsGroup" />
如何在服务器端或客户端克服这个问题?
I am having two controls in that i have set the required field vaildators for that controls.my issues is for the time being i have set that two controls disabled but this required validator is checking if the two controls in the disabled mode.i am checking that required field validator while clicking the save button.how to overcome this?
<asp:DropDownList ID="DropDownList1" Width="150" runat="server" TabIndex="17" Enabled="false"
AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="--Select Company--"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="DropDownList1"
ValidationGroup="UserDetailsGroup" InitialValue="--Select Company--" ErrorMessage="*"></asp:RequiredFieldValidator>
texboxcontrol:
<asp:TextBox ID="AcquiredDate" runat="server" Width="150" TabIndex="18" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="AcquiredDate"
ValidationGroup="UserDetailsGroup" ErrorMessage="*"></asp:RequiredFieldValidator>
here the save button is the image button?
<asp:ImageButton ID="Save" runat="server" ImageUrl="~/Images/save-button.gif"
OnClick="Save_Click" TabIndex="41" ValidationGroup="UserDetailsGroup" />
How to overcome this pblm either in server side or client side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
禁用验证器:
Disable the Validators: