Asp.Net onkeyup form validation

I rewrote standard javascript to check asp.net, so some (css) classes will be set to either validator, or true or false.

This javascript runs on "onchange" (a standard asp.net behavior event, but I would like this javascript to fire on "onkeyup"

Is there any way to change this?

+3
source share
1 answer

You can put all your validators in one verification group, and onkeyup initiates their verification.

Something like that:

<asp:TextBox ID="TextBox1" runat="server" ValidationGroup="Custom_ValidationGroup" onkeyup="Page_ClientValidate('Custom_ValidationGroup'); "/>

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1" ForeColor="Red" ErrorMessage="Enter integers only." ValidationExpression="^\d+$" Display="Dynamic" ValidationGroup="Custom_ValidationGroup" />
+2
source

Source: https://habr.com/ru/post/1750518/


All Articles