Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RegisterOnSubmitStatement after client-side validation

Tags:

People also ask

Why is client-side validation not enough?

Client-side validation should only be used to improve user experience, never for security purposes. A client-side input validation check can improve application performance by catching malformed input on the client and, therefore, saving a roundtrip to the server.

How do I turn off client-side validation?

To disable client-side validation, set the page's ClientTarget property to 'Downlevel' ('Uplevel' forces client-side validation). Alternatively, you can set an individual validator control's EnableClientScript property to 'false' to disable client-side validation for that specific control.

How do I enable client-side validation?

We can enable and disable the client-side validation by setting the values of ClientValidationEnabled & UnobtrusiveJavaScriptEnabled keys true or false. This setting will be applied to application level. For client-side validation, the values of above both the keys must be true.

What is client-side validation in asp net with example?

ASP.NET client side coding has two aspects: Client side scripts : It runs on the browser and in turn speeds up the execution of page. For example, client side data validation which can catch invalid data and warn the user accordingly without making a round trip to the server.


I need to insert a bit of Javascript into the process when a Web Form is submitted, but after the client side validation takes place.

RegisterOnSubmitStatement seems to place the javascript before the validation.

Anyone know how to get it to render after?

Solution found: In a web control, I put something like this:

protected override OnInit(EventArgs e) { 
   Page.SaveStateComplete += new EventHandler(RegisterSaveStuff); 
   base.OnInit(e); 
} 

void RegisterSaveStuff(object sender, EventArgs e) { 
   Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "name", "JS code here"); 
} 

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!