Binding Repeater in Page_PreRender

Discussion in 'ASP .Net' started by Sparhawk, Sep 4, 2004.

  1. Sparhawk

    Sparhawk Guest

    I ran into troubles binding my repeater controls in Page_PreRender.
    The problem is that the Repeater_ItemCommand does not fire if the
    control is bound in Page_PreRender. It works fine if I am binding in
    Page_Load.

    Probably I am missing something here. WHY doesn't it work?

    I like to move much of by databinding to Page_PreRender because of the
    following problem:

    Page_Load reads all data and does databinding
    Events are handled, data is changed and I have to do data loading and
    binding again.

    This is why I try to load all data AFTER handling user events (clicks,
    ....) whenever possible (i.e. in Page_PreRender).

    Am I violating a design principle here?

    Thanks for help,
    Sparhawk
     
    Sparhawk, Sep 4, 2004
    #1
    1. Advertising

  2. Looks like you are. PreRender is supposed to be the last touch to your page.
    If you want to avois reloading data, collect all values affecting data
    loading in the Page_Load. You can use __EVENTTARGET and __EVENTARGUMENT
    parameters to find out who caused the postback.

    Eliyahu

    "Sparhawk" <> wrote in message
    news:...
    > I ran into troubles binding my repeater controls in Page_PreRender.
    > The problem is that the Repeater_ItemCommand does not fire if the
    > control is bound in Page_PreRender. It works fine if I am binding in
    > Page_Load.
    >
    > Probably I am missing something here. WHY doesn't it work?
    >
    > I like to move much of by databinding to Page_PreRender because of the
    > following problem:
    >
    > Page_Load reads all data and does databinding
    > Events are handled, data is changed and I have to do data loading and
    > binding again.
    >
    > This is why I try to load all data AFTER handling user events (clicks,
    > ...) whenever possible (i.e. in Page_PreRender).
    >
    > Am I violating a design principle here?
    >
    > Thanks for help,
    > Sparhawk
     
    Eliyahu Goldin, Sep 5, 2004
    #2
    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. Ashish

    Page_Prerender

    Ashish, Sep 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    498
    Ashish
    Sep 24, 2004
  2. Ashish

    page_prerender

    Ashish, Sep 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,872
    Jonathan Allen
    Sep 25, 2004
  3. Sky Sigal
    Replies:
    0
    Views:
    363
    Sky Sigal
    Aug 3, 2004
  4. TPS
    Replies:
    2
    Views:
    3,535
  5. PokerJoker

    Problem with binding in Page_PreRender

    PokerJoker, Aug 30, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    133
    PokerJoker
    Aug 30, 2004
Loading...

Share This Page