473,378 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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
in.

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
OnSortCommand

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.
Nov 18 '05 #1
1 1327
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?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 1 Nov 2004 21:17:03 -0800, ti*******@omegacreations.com (Kepler)
wrote:
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
in.

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
OnSortCommand

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.


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeremy Ames | last post by:
I am trying to use a datagrid to pull information from a database. I prefer to use latebinding to this. Well, I finally got my information to populate the datagrid, but the information came out in...
2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
7
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
2
by: News | last post by:
Hi I need help to display and edit data in a data grid within a repeater. The code is below: Sub dgrdEvents_EditCommand(sender As Object, e As DataGridCommandEventArgs)...
0
by: Ferret | last post by:
I've found what seems to be a nasty bug in the DataGrid and Repeater classes. If CreateChildControls gets called before LoadViewState, ViewState fails to map and you end up with nothing on a...
3
by: Maziar Aflatoun | last post by:
Hi everyone, I have a datagrid that I create inside a Repeater at runtime. I have defined a checkbox beside each row so that users can select multiple rows. <asp:datagrid id="dgProducts"...
1
by: JD | last post by:
Hello Everyone, I am trying to do a page where when the user gets to the page it will look very similar to the following: <table border=1> <tr> <td bgcolor="green" colspan="2">Main...
2
by: mark4asp | last post by:
This page is currently using a Repeater control to create a table with 6 columns. The first column has 2 ImageButton controls and a common header. How can I do this with a DataGrid ? I need...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.