Last post Jan 15, 2017 02:40 PM by PatriceSc
Jan 14, 2017 07:15 PM|JAYHAWKER|LINK
Jan 15, 2017 11:05 AM|PatriceSc|LINK
Jan 15, 2017 02:12 PM|JAYHAWKER|LINK
Thanks for the reply, and sorry for not being clear. What I am actually trying to do is catch validation errors that are a "runat="server" control on the client side as well as the server side. Of course, I could run code on each control client side, but
I was looking for a way to do a sweep of all runat="server" validation server controls client side before running Javscript code for a particular control. Let's say I have the following HTML.
<asp:textbox id="txtIndexRatex" runat="server" AutoPostBack="True" cssClass="txt" onFocus="this.select()" OnTextChanged="txtIndexRatex_TextChanged" onChange="changed('txtIndexRatex');"></asp:textbox>
<asp:comparevalidator id="IndexRateCompareValidator7" style="Z-INDEX: 199; LEFT: 359px; POSITION: absolute; TOP: 288px" Display="Dynamic"
runat="server" Operator="GreaterThan" Type="Double" ValueToCompare="0" ErrorMessage="Please enter POSITIVE numbers only!" ControlToValidate="txtIndexRatex" Enabled="False" SetFocusOnError="True"></asp:comparevalidator>
$('input[id$=' + ctrl+ ']').hide("slow");
Obviously, the above hides the textbox txtIndexRatex after changing the text in the textbox, but I only want that to happen if the text entered is a positive number (the compare validator is suppose to check for this). In this case the validation error shows
unless there are no validation errors.
I hope this makes it easier to understand what I am trying to do.
Jan 15, 2017 02:40 PM|PatriceSc|LINK
Never tried this scenario but have a look at http://stackoverflow.com/questions/7640426/why-validatorvalidate-validates-all-the-requiredfieldvalidator-controls-on-the
Those validator controls have both a client side and server side validation and from my search it seems as shown above that ValidatorValidate allows to check a particular control (rather than all controls). If someone wants to give this a try, knowing which
.NET version you are targeting could help.