Binding Repeater in Page_PreRender

  • Thread starter Thread starter Sparhawk
  • Start date Start date
S

Sparhawk

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
 
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
 
Back
Top