473,408 Members | 1,722 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,408 software developers and data experts.

Datagrid vanishing and taking all my nested controls with it.

I've got a datagrid with some nested controls, created at design-time. The
controls themselves have no databound values.

After a few other operations on the page (selecting a few parameters, etc),
a button is clicked and the databind occurs. This part works fine. It
retreives the 4-10 rows it needs and using the itemdatabound formats
everything nicely.

What I intend to do then, is after the user has gone through the nested
controls and entered the values they want for each line item, they click a
button to bulk-submit them. This is where it all goes wrong. On the
postback, the datagrid.items.count is 0, there's no controls collection
anymore and the whole grid vanishes. Obviously, I can't get the values
anymore.

The debugger and the designer both report that viewstate is on for the
datagrid, for the panel containng the datagrid, and for the page. Is there
any conceivable reason the contents of the datagrid would suddenly disappear?

If I rebind, then of course I get the whole thing back but all my controls
get reset and I no longer have the user-submitted values. By all accounts,
all I should have to do after the user hits submit is iterate through the
datagriditems and call the appropriate findcontrol...but if the items keeps
resetting to empty, there's nothing there for me...

Any ideas? Thanks much if you've got 'em...
Nov 19 '05 #1
2 1673
On Fri, 24 Jun 2005 10:43:12 -0700, nulldevice wrote:
I've got a datagrid with some nested controls, created at design-time. The
controls themselves have no databound values.

After a few other operations on the page (selecting a few parameters, etc),
a button is clicked and the databind occurs. This part works fine. It
retreives the 4-10 rows it needs and using the itemdatabound formats
everything nicely.

What I intend to do then, is after the user has gone through the nested
controls and entered the values they want for each line item, they click a
button to bulk-submit them. This is where it all goes wrong. On the
postback, the datagrid.items.count is 0, there's no controls collection
anymore and the whole grid vanishes. Obviously, I can't get the values
anymore.

The debugger and the designer both report that viewstate is on for the
datagrid, for the panel containng the datagrid, and for the page. Is there
any conceivable reason the contents of the datagrid would suddenly disappear?

If I rebind, then of course I get the whole thing back but all my controls
get reset and I no longer have the user-submitted values. By all accounts,
all I should have to do after the user hits submit is iterate through the
datagriditems and call the appropriate findcontrol...but if the items keeps
resetting to empty, there's nothing there for me...

Any ideas? Thanks much if you've got 'em...

I think that on postback the data from for the datagrid is empty and
therefore your datagrid will be empty. Examine what happens before the
rebind. That path must have data!

Nov 19 '05 #2
Well, I got it to work this morning, and the solution is entirely baffling to
me.

On this page were some other controls that were being populated dynamically.
a specific type of literal control we developed. on page Init, there's a
function that walks the controls tree and does a typeof on any control it
finds, and when it hits one, it does the mojo it needs to associate those
controls with the data they're supposed to be associated with.

Whenever the "typeof" hit the datagrid in the init, it'd drop all its
viewstate information. When this happened, grid.datasource became nothing
and the grid would disappear. When I removed the control-tree walk, he
grids stopped disappearing. This was also happening for asp tables. I have
not tried datalists or repeaters yet.

So I put in a workaround, but it's very perplexing that a typeof() would
cause my grids to freak out.

"intrader" wrote:
I think that on postback the data from for the datagrid is empty and
therefore your datagrid will be empty. Examine what happens before the
rebind. That path must have data!

Nov 19 '05 #3

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

Similar topics

2
by: Greg | last post by:
There is a repeating issue of controls vanishing from a form in the Dev environment which is starting to get annoying. What happens is that I will have a form open in the IDE. The form will have...
2
by: Scott | last post by:
Hi all. A few days ago i ask this question and got a good quick response. I tried out what they said and it worked. However I have now come to try the same thing in another program and it...
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...
3
by: Ben | last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using the StrengthControls SmartScroller as recommended to maintain my scroll position. Anyway, inside the datagrid I have...
2
by: Josh | last post by:
Hi Guys, I have been stuck on this problem for several days now, i have a set of nested datagrids. Inside the second datagrid i have a dropdown list, a textbox and a label. I want the textbox...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
2
by: Linda | last post by:
Greetings, I am experiencing a problem similar to that mentioned in <a...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.