Problem with OnItemCreated and InitializePager being called four times

  • Thread starter Bernal Schooley
  • Start date
B

Bernal Schooley

Hello,

I'm hoping someone here can shed some light on this problem or suggest
alternate approaches.

I'm creating a custom datagrid by extending the standard one. In it
I'm putting additional stuff in the pager section. My code will work
by overriding either OnItemCreated or InitializePager, but both of
those are called 4 times per page load. It's called twice between
"Begin LoadViewState" and "End LoadViewState" and then twice between
"Begin Raise PostBackEvents" and "End Raise PostBackEvents".

The end result is only one set of my changes appears on the grid. I
can only assume that the two calls are one for the top pager and one
for the bottom pager, even when the top pager is not enabled. During
the first two calls my CurrentPageIndex is the old number and then
during the last two calls my CurrentPageIndex is the new number.

My question is is there any way to tell from within the overridden
method which call is for which pager (ie. top or bottom if that's what
is happening) and if it's being called during the LoadViewState or
PostBackEvents?

Thanks for any thoughts you can share on the subject.

Regards,
--Bernal
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top