I want to check page validation on client side, like Page.Validate()
but it's a server side method. Is there any client side function which can work like Page.Validate()
with JavaScript?
Page_ClientValidate() will work. It returns true if the page was valid and it works fine. If you are using ASP.NET 2.0, pass the validation group name as a parameter. E.g.
Client-side validation is visible to the user. It involves validation on input forms through JavaScript. For example, if input is submitted for a phone number or email, a JavaScript validator would provide an error if anything is submitted that does not conform to a phone number or email.
Where to write JavaScript code in ASP.Net Form? You can write the JavaScript code in the ASP.Net Page in the following sections. You can write the JavaScript code in the head section, it is the recommended way to write the code, the code must be enclosed in the following syntax: <head id="Head1" runat="server">
Page_ClientValidate()
will work. It returns true if the page was valid and it works fine.
If you are using ASP.NET 2.0, pass the validation group name as a parameter.
E.g.
if(Page_ClientValidate("SomeValidationGroup")) alert('its valid');
Otherwise if there is no validation group Page_ClientValidate("")
will handle it.
E.g.
if(Page_ClientValidate("")) alert('its valid');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With