Where to put validation code, for a FormView control

P

Paul Aspinall

Hi
I want to put all my validation code in one place, for my FormView control,
regardless of whether its editing or inserting data.

Is there a 'Validation' event somewhere??

or do I point the ItemUpdating and ItemInserting events to the same place,
and put my validation code there?

Thanks
 
P

Peter Blum

I can understand your desire to find a Validation event. ASP.NET does
validation differently. You add Validation web controls throughout the page
to establish both the rules and visual presentation.

The "validation event" is really a call to the Page.Validate() method, which
goes through all validators (matching the validation group of the button) to
ask them to validate themselves. You check the results of that process by
confirming Page.IsValid is true in your post back event handler.

There are numerous articles and tutorials for ASP.NET validation on the web,
including in the Tutorials tab on this site. I put together an article that
fills in some of gaps: http://aspalliance.com/699.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top