Web Form Validation in C#

Hello I have a .aspx(c#) webform where a user enters his firstname, age, city, email, phone number
and in the end hits a submit button. currently i am doing validation just to know if he has entered anything or not.

I want to do something like this. when the user hits submit button we capture his values and check all values for eg: phone number shouldnt be character, email should be proper etc and if one of the validation fails we still continue and in the end we let the user know which all controls or fields have failed showing him some message on the web page like enter correct phone number, enter correct email.

I hope i made the scenario clear. how should i approach this?

thanks
as_coderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
Use javascript

<FORM onSubmit="submitEvent()">  in your form tag...

when the submit button is clicked it will call that event.

then check each fiield by id

and if they don't equal what you want, then return false.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rajapandian_81Commented:
0
rajapandian_81Commented:
0
silemoneCommented:
just to touch on the server side validation -

con: they are heavier on the page.  they have to load on server side which can slow performance if you have a lot of them.  

pro: if someone turns off their javascript, server side validation will always validate.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.