Home All Groups Group Topic Archive Search About

Where in the page lifecycle does validation occur?

Author
25 Aug 2006 8:04 AM
Paul
Hi all,

I don't use auto postbacks on my web site to keep it javascript-free
and browser agnostic. Whenever there's a postback to my page I'm using
the Page_Load event to use the posted data for database updates.
However, the page hasn't been validated at this point. I can call
Validate() at this point, but this means the controls will be validated
twice.

At what point in the page lifecycle are the controls validated? When
would be the best time and place to use the posted data for a database
update, if not using auto postbacks? My current method doesn't seem
ideal.

Thanks in advance,

Paul

Author
25 Aug 2006 9:35 AM
nirmal.c
> Validate() at this point, but this means the controls will be validated
> twice.

You can disable it by .CausesValidation property

> At what point in the page lifecycle are the controls validated? When
> would be the best time and place to use the posted data for a database
> update, if not using auto postbacks? My current method doesn't seem
> ideal.


After Page_Load.

http://msdn2.microsoft.com/en-us/library/ms178472.aspx

Regards
Nirmal
Author
25 Aug 2006 10:35 PM
Paul
Thanks Nirmal,

If I don't want to use button events (to avoid the need for javascript)
where's the best place to check if the posted data is valid and do
database updates, redirects etc.?

Thanks,

Paul

nirma***@gmail.com wrote:
Show quote
> > Validate() at this point, but this means the controls will be validated
> > twice.
>
> You can disable it by .CausesValidation property
>
> > At what point in the page lifecycle are the controls validated? When
> > would be the best time and place to use the posted data for a database
> > update, if not using auto postbacks? My current method doesn't seem
> > ideal.
>
>
>  After Page_Load.
>
> http://msdn2.microsoft.com/en-us/library/ms178472.aspx
>
> Regards
> Nirmal
Author
8 Sep 2006 4:26 PM
nirmal.c
Paul , You are the best person to judge based on your apps behavior.

However I might end up doing it at LoadComplete.

Paul wrote:
Show quote
> Thanks Nirmal,
>
> If I don't want to use button events (to avoid the need for javascript)
> where's the best place to check if the posted data is valid and do
> database updates, redirects etc.?
>
> Thanks,
>
> Paul
>
> nirma***@gmail.com wrote:
> > > Validate() at this point, but this means the controls will be validated
> > > twice.
> >
> > You can disable it by .CausesValidation property
> >
> > > At what point in the page lifecycle are the controls validated? When
> > > would be the best time and place to use the posted data for a database
> > > update, if not using auto postbacks? My current method doesn't seem
> > > ideal.
> >
> >
> >  After Page_Load.
> >
> > http://msdn2.microsoft.com/en-us/library/ms178472.aspx
> >
> > Regards
> > Nirmal

AddThis Social Bookmark Button