HighTechTalks DotNet Forums  

where in page life cycle should databound control populate its data?

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss where in page life cycle should databound control populate its data? in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
TS
 
Posts: n/a

Default where in page life cycle should databound control populate its data? - 11-16-2007 , 03:43 PM






i'm curious as to which events should a drop down list's values be loaded
and when the correct value should be set selected.

And what is the logic behind this timing?

thanks!!!



Reply With Quote
  #2  
Old   
TS
 
Posts: n/a

Default Re: where in page life cycle should databound control populate its data? - 11-16-2007 , 04:16 PM






also is there any concerns with AJAX?

someone at work said he had to move the code that was binding a drop down
list from OnLoad to onPreRender because of an issue with Ajax

"TS" <manofsteele1 (AT) nospam (DOT) nospam> wrote

Quote:
i'm curious as to which events should a drop down list's values be loaded
and when the correct value should be set selected.

And what is the logic behind this timing?

thanks!!!




Reply With Quote
  #3  
Old   
Steven Cheng[MSFT]
 
Posts: n/a

Default Re: where in page life cycle should databound control populate its data? - 11-18-2007 , 09:13 PM



Hi TS,

AS for databinding and data population for a control, I think it can be
performed at any events before the page render its content. Therefore, all
the following page events during the server-side processing is ok:

Init, Load, PreRender

Actually, from MSDN document, you can get "PreRender" is the last event you
can make changes(which will be persisted into viewstate). Also,
databinding is not necessarily be performed on every request, only when
data changed will you need to perform databinding(or at the first request)
since most databound control store bound data into viewstate(for populating
control collection in sequential requests).

For AJAX, normally, it just do the postback in background thread through
xmlhttp, therefore, I think the basic logic mentioned above is also
suitable. For particular problem or issue, it will depend on how that
problem will affect the page processing or control lifecycle.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.





--------------------
Quote:
Subject: Re: where in page life cycle should databound control populate
its data?
Date: Fri, 16 Nov 2007 16:16:56 -0600


also is there any concerns with AJAX?

someone at work said he had to move the code that was binding a drop down
list from OnLoad to onPreRender because of an issue with Ajax

"TS" <manofsteele1 (AT) nospam (DOT) nospam> wrote in message
news:OzdYxmJKIHA.5860 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
i'm curious as to which events should a drop down list's values be
loaded
and when the correct value should be set selected.

And what is the logic behind this timing?

thanks!!!






Reply With Quote
  #4  
Old   
TS
 
Posts: n/a

Default Re: where in page life cycle should databound control populate its data? - 11-19-2007 , 07:14 AM



thanks steven

"Steven Cheng[MSFT]" <stcheng (AT) online (DOT) microsoft.com> wrote

Quote:
Hi TS,

AS for databinding and data population for a control, I think it can be
performed at any events before the page render its content. Therefore, all
the following page events during the server-side processing is ok:

Init, Load, PreRender

Actually, from MSDN document, you can get "PreRender" is the last event
you
can make changes(which will be persisted into viewstate). Also,
databinding is not necessarily be performed on every request, only when
data changed will you need to perform databinding(or at the first request)
since most databound control store bound data into viewstate(for
populating
control collection in sequential requests).

For AJAX, normally, it just do the postback in background thread through
xmlhttp, therefore, I think the basic logic mentioned above is also
suitable. For particular problem or issue, it will depend on how that
problem will affect the page processing or control lifecycle.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no
rights.





--------------------
Subject: Re: where in page life cycle should databound control populate
its data?
Date: Fri, 16 Nov 2007 16:16:56 -0600


also is there any concerns with AJAX?

someone at work said he had to move the code that was binding a drop down
list from OnLoad to onPreRender because of an issue with Ajax

"TS" <manofsteele1 (AT) nospam (DOT) nospam> wrote in message
news:OzdYxmJKIHA.5860 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
i'm curious as to which events should a drop down list's values be
loaded
and when the correct value should be set selected.

And what is the logic behind this timing?

thanks!!!








Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.