Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Validation server side

I have an ASP.NET webform which I want to validate Client-Side and Server-Side, using the same validation controls. I can't seem to find the solution for this - the client validation works great, but when I disable javascript - It ignores the validation.

Help would much be appreciated.

Roman

like image 741
Roman Avatar asked Jan 04 '10 17:01

Roman


1 Answers

Explicitly call Page.Validate() on the server side.

Or the overloaded Page.Validate(string) to target one of your validation groups.

Update:

I forgot, after you run Validate(..), check the Page.IsValid property - it's up to you to stop the page from submitting if this property == false.

like image 68
John K Avatar answered Nov 06 '22 11:11

John K