asp:table remembering state!?

G

Guest

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)
 

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

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top