DataGrid and Repeater strange disappearance bug



I'm fighting a really strange bug that involves both a DataGrid and a
Repeater disappearing on postback. The strange thing is that I've
distilled the problem down to a simple program, that originally could
reproduce the problem, but now can't, even as I add complexity back

The basic scenario is a custom DataGrid (just make a class that
derives from DataGrid) that has a LinkButton in a HeaderTemplate that
has a CommandName="sort" and CommandArgument="whatever". Only
DataBind if it's not a postback, and there you go. (I can give more
code later). It's actually a bit more complicated in that sorting and
paging are handled mostly within the control. I've intercepted almost
all the handlers I can to see what is different between the working
version and the non-working version (sometimes just a difference in
time of day it seems). Here's what I found.

Postback (when it's working):
grid OnInit
page OnInit
grid LoadViewState
grid CreateControlCollection
grid InitializeItem
page OnLoad
grid OnLoad

Postback (when it doesn't work - and DataGrid disappears):
grid OnInit
page OnInit
grid CreateControlCollection
grid LoadViewState
page OnLoad
grid OnLoad

The actual control is IDENTICAL in both cases. I'm pulling my hair
out to figure out what is possibly different. This problem is driving
me crazy, especially since I originally duplicated the problem in a
simplified test case. Once I changed a small something that caused
the problem to go away in the test case, I then went and changed it
back, and WHAMMO, it didn't happen again. In fact, I can't get it to
happen at all in my test case again, even though all the code is
almost a duplicate of my bigger app. Any leads at all will be greatly
appreciated. I'll post more code tomorrow.



Scott Allen

Hi Tim:

I think we will need to see some more code. When you do the sorting,
is there any possibility you could be binding to an empty DataSource?

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