Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   When does control data binding occur in a life cycle of a page? (http://www.velocityreviews.com/forums/t600472-when-does-control-data-binding-occur-in-a-life-cycle-of-a-page.html)

bogdan 03-20-2008 07:54 PM

When does control data binding occur in a life cycle of a page?
 
I need to execute some code _after_ page controls are bound to data (e.g.
DropDownList). I could probably handle DataBound events for each control.
But if I wanted to place the code in a page handler, where would I put it?
Does Page_Load() event is raised after or before control data binding takes
place?

Thanks,
Bogdan



Teemu Keiski 03-20-2008 08:21 PM

Re: When does control data binding occur in a life cycle of a page?
 
Hi,

do you mean binding done by data source controls? If you bind manually that
of course happens whenever you call dataBind() for the control, so when that
happens is up to you, the page developer.

Yes you could do that with DataBound event. Data source conrreols also have
their own events like SqldataSource's Selected event

Quite common is that on first request, control are bound at PreRender stage
but on postback they must then be populated before Page_Load because
postback data is already loaded before that, so data in lists etc must exist
so that state change based on postback data, can be made.

SqldataSource for example gets its select operation called in PreRender by
the databound controls.


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"bogdan" <bogdan@nospam.com> wrote in message
news:OoxBIRsiIHA.6092@TK2MSFTNGP06.phx.gbl...
>I need to execute some code _after_ page controls are bound to data (e.g.
>DropDownList). I could probably handle DataBound events for each control.
>But if I wanted to place the code in a page handler, where would I put it?
>Does Page_Load() event is raised after or before control data binding takes
>place?
>
> Thanks,
> Bogdan
>
>





All times are GMT. The time now is 11:13 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.