requiredfieldvalidator

disable RequiredFieldvalidator

爱⌒轻易说出口 提交于 2021-02-08 10:27:22
问题 I have RequiredFieldvalidator and I want in certain cases to disable it. this is the RequiredFieldvalidator: <asp:RequiredFieldValidator ID="RfvHul" runat="server" ErrorMessage="Error" ControlToValidate="txtBox" Display="None"></asp:RequiredFieldValidator> and I've tried to do this but all these lines of code gave me Page_IsValid = false $("#RfvHul").attr("disabled", true); ValidatorEnable(document.getElementById("<%=RfvHul.ClientID%>"), false); document.getElementById("RfvHul").Enabled =

disable RequiredFieldvalidator

送分小仙女□ 提交于 2021-02-08 10:24:43
问题 I have RequiredFieldvalidator and I want in certain cases to disable it. this is the RequiredFieldvalidator: <asp:RequiredFieldValidator ID="RfvHul" runat="server" ErrorMessage="Error" ControlToValidate="txtBox" Display="None"></asp:RequiredFieldValidator> and I've tried to do this but all these lines of code gave me Page_IsValid = false $("#RfvHul").attr("disabled", true); ValidatorEnable(document.getElementById("<%=RfvHul.ClientID%>"), false); document.getElementById("RfvHul").Enabled =

Multiple RequiredFieldValidators on page but they need to apply to different button clicks

只谈情不闲聊 提交于 2020-01-29 13:35:46
问题 I'm working on a asp.net page and I have the following scenario: I have 2 fields that have requiredfieldvalidators which need to "fire" their validation when button1 is clicked but NOT when button2 is clicked and another field which is validated by another requiredfieldvalidator with the opposite scenario. (requiredfieldvalidator for this field needs to "fire" when button2 is clicked but NOT when button1 is clicked.) Any suggestions for the simplest solution would be appreciated. Thanks in

Multiple RequiredFieldValidators on page but they need to apply to different button clicks

不羁岁月 提交于 2020-01-29 13:35:31
问题 I'm working on a asp.net page and I have the following scenario: I have 2 fields that have requiredfieldvalidators which need to "fire" their validation when button1 is clicked but NOT when button2 is clicked and another field which is validated by another requiredfieldvalidator with the opposite scenario. (requiredfieldvalidator for this field needs to "fire" when button2 is clicked but NOT when button1 is clicked.) Any suggestions for the simplest solution would be appreciated. Thanks in

Why ValidatorValidate() validates all the RequiredFieldValidator controls on the page?

依然范特西╮ 提交于 2020-01-24 09:06:12
问题 In following code Why ValidatorValidate(v) validates all the RequiredFieldValidator controls on the page? It should execute only RequiredFieldValidator1 not RequiredFieldValidator2 . Here is code. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function check() { var v = document.getElementById("<%=RequiredFieldValidator1.ClientID%>"); ValidatorValidate(v); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat=

How to make RequiredAttribute work with an enum field

[亡魂溺海] 提交于 2020-01-03 17:51:14
问题 I've recently realized that RequiredAttribute does not work on enum fields. Let's say I have two select elements called ddlOfficers and ddlApplicationTypes on the form both rendered with the help of HtmlHelper methods. The helper method for creting ddlOfficers is as follows: @Html.DropDownListFor(x => x.OfficerID, Model.Officers, "<Choose>", new { id = "ddlAddressedOfficer" }) Where OfficerID is a Nullable<int> For ddlApplicationTypes I had to write an extension method that would let me

How to make RequiredAttribute work with an enum field

女生的网名这么多〃 提交于 2020-01-03 17:50:09
问题 I've recently realized that RequiredAttribute does not work on enum fields. Let's say I have two select elements called ddlOfficers and ddlApplicationTypes on the form both rendered with the help of HtmlHelper methods. The helper method for creting ddlOfficers is as follows: @Html.DropDownListFor(x => x.OfficerID, Model.Officers, "<Choose>", new { id = "ddlAddressedOfficer" }) Where OfficerID is a Nullable<int> For ddlApplicationTypes I had to write an extension method that would let me

RequiredFieldValidator with ValidationGroup doesn't validate

放肆的年华 提交于 2020-01-01 11:48:12
问题 Here's my markup: Name: <asp:TextBox ID="txtNewName" runat="server" ValidationGroup="NewDepartmentValidationGroup" /> <asp:RequiredFieldValidator ID="vldtxtNewName" runat="server" ControlToValidate="txtNewName" ErrorMessage="Required Field" /><br /> Description: <asp:TextBox ID="txtNewDescription" runat="server" ValidationGroup="NewDepartmentValidationGroup"/> <asp:RequiredFieldValidator ID="vldtxtNewDescription" runat="server" ControlToValidate="txtNewDescription" ErrorMessage="Required

RequiredFieldValidator with ValidationGroup doesn't validate

末鹿安然 提交于 2020-01-01 11:48:07
问题 Here's my markup: Name: <asp:TextBox ID="txtNewName" runat="server" ValidationGroup="NewDepartmentValidationGroup" /> <asp:RequiredFieldValidator ID="vldtxtNewName" runat="server" ControlToValidate="txtNewName" ErrorMessage="Required Field" /><br /> Description: <asp:TextBox ID="txtNewDescription" runat="server" ValidationGroup="NewDepartmentValidationGroup"/> <asp:RequiredFieldValidator ID="vldtxtNewDescription" runat="server" ControlToValidate="txtNewDescription" ErrorMessage="Required

Working RequiredFieldValidator along with javascript

[亡魂溺海] 提交于 2019-12-30 11:33:07
问题 I have multiple RequiredFieldValidator such as: <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtbox1" Display="Dynamic" ErrorMessage="Required Field" SetFocusOnError="True" ValidationGroup="validator1" CssClass="validator" /> Linked to this button: <asp:LinkButton runat="server" ID="btnNext1" Text="Next Page" CssClass="btn" ValidationGroup="validator1" /> Along with some javascript: <script type="text/javascript"> $(function() { function nextPage1