|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
asp:table remembering state?runtime. The controls themselves get/set values in a datatable which is stored in viewstate over postbacks. Here is basically what I am doing: pull datatable out of viewstate for each row in datatable create tablerow create tablecells create controls get data items from datatable and place the values in the controls add controls to tablecells add tablecells to tablerow add tablerow to asp table draw the control I save values back to the datatable in a similar way, but instead scroll through the rows in the asp table and place the values in the appropriate datatable item. This all works fine, but the problem is with deleting a row. I simply delete the desired row from the datatable and then call my table creation method described above. This should surely mean that the asp table will not display the row as it no longer exists in the datatable. But what happens is that a row is deleted, but all the ones below it "bubble up" in that they take on the previous rows value. So it seems as if the bottom row has been removed. I've checked my datatable and the values in here don't correspond with whats being displayed. Is there some form of caching going on that I'm not seeing? ViewState is turned off for the asp table and hence all of its controls. Any ideas?!!! (p.s. sorry for the long description, but I thought I'd try and give you a clear picture of whats going on) Hi Davey,
Items in ViewState get saved in order. If you get rid of items, that doesn't change. And I'm not 100% sure that turning off ViewState for the table is going to turn it off for the controls in the cells. Try this: http://www.wilsondotnet.com/Demos/ViewState.aspx This is a ViewState parser. It doesn't tell you the names of the controls, because, as I said, it relies completely on the order in which they are saved to ViewState and loaded from ViewState. But if you have values in the controls, odds are you'll be able to figure out what's what. At the very least, should all else fail, you could simply hide rows instead of deleting them. Setting Visible = False will keep them from being rendered, but will preserve the order for your ViewState. Of course, if you decide to try sorting the rows, that wouldn't help you anymore, but you haven't said anything about doing that. Lisa Davey P wrote: Show quoteHide quote > I have an asp.net table which I am populating with controls dynamically at > runtime. The controls themselves get/set values in a datatable which is > stored in viewstate over postbacks. Here is basically what I am doing: > > pull datatable out of viewstate > > for each row in datatable > create tablerow > create tablecells > create controls > get data items from datatable and place the values in the controls > add controls to tablecells > add tablecells to tablerow > add tablerow to asp table > > draw the control > > I save values back to the datatable in a similar way, but instead scroll > through the rows in the asp table and place the values in the appropriate > datatable item. > This all works fine, but the problem is with deleting a row. I simply delete > the desired row from the datatable and then call my table creation method > described above. This should surely mean that the asp table will not display > the row as it no longer exists in the datatable. But what happens is that a > row is deleted, but all the ones below it "bubble up" in that they take on > the previous rows value. So it seems as if the bottom row has been removed. > I've checked my datatable and the values in here don't correspond with whats > being displayed. Is there some form of caching going on that I'm not seeing? > ViewState is turned off for the asp table and hence all of its controls. > > Any ideas?!!! > > (p.s. sorry for the long description, but I thought I'd try and give you a > clear picture of whats going on)
Table height 100% has no effect
Problem using AddHandler for dynamically created WebControls Dynamic Web Control Event Handling modify display of RadioButtonList items Question about IE Web Controls Toolbar. asp.net 1.1 wizard control Alignment of a System.Web.UI.WebControls.Image object Using html controls or asp controls Parent of WebControl Three buttons - one is pressed down |
|||||||||||||||||||||||