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

Discussion in 'ASP .Net Building Controls' started by TS, Nov 16, 2007.

  1. TS

    TS Guest

    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!!!
     
    TS, Nov 16, 2007
    #1
    1. Advertising

  2. TS

    TS Guest

    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" <> wrote in message
    news:...
    > 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!!!
    >
     
    TS, Nov 16, 2007
    #2
    1. Advertising

  3. 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/subscriptions/managednewsgroups/default.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/subscriptions/support/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" <> wrote in message
    >news:...
    >> 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!!!
    >>

    >
    >
    >
     
    Steven Cheng[MSFT], Nov 19, 2007
    #3
  4. TS

    TS Guest

    thanks steven

    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > 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/subscriptions/managednewsgroups/default.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/subscriptions/support/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" <> wrote in message
    >>news:...
    >>> 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!!!
    >>>

    >>
    >>
    >>

    >
     
    TS, Nov 19, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Griff

    Control events - page life-cycle

    Griff, Sep 20, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    937
    Griff
    Sep 20, 2006
  2. lander
    Replies:
    5
    Views:
    2,540
    Mark Rae [MVP]
    Mar 3, 2008
  3. bogdan
    Replies:
    1
    Views:
    2,413
    Teemu Keiski
    Mar 20, 2008
  4. TS
    Replies:
    5
    Views:
    863
  5. Henry
    Replies:
    6
    Views:
    451
    Guess
    Apr 10, 2005
Loading...

Share This Page