J
Jeremy
I am writing a complex data editor, and I am building a table with
other controls in it on the fly. ( I know, not for the faint of heart.
My other options are a quadruply nested data repeater, which is ugly
in its own right)
When the form first loads up, I populate a drop down list, set the
selected item to the first item, return my data for the selected item
in the drop down list, then build my table.
I am creating a few hidden controls in each row of the table to keep
track of some information.
I've been googling for days, and all of the viewstate articles I come
across usually deal with information not being persisted in
dynamically loaded controls.
However, my problem is just the opposite. Even though I set the value
of the hidden field in code everytime I rebuild the table, it
maintains the value that it had when the page first loaded up. I tried
setting the EnableViewState property for the hidden field to false
both before and after I add it to the controls collection to no avail.
The other interesting thing to note here is that my dynamically loaded
textboxes work fine, because when I load a different set of data, the
ID of the textbox changes, whereas the ID of the hidden fields stays
pretty much constant.
How can I prevent the value of my hidden fields from being overwritten
by the view state when I reload them?
Thanks!
other controls in it on the fly. ( I know, not for the faint of heart.
My other options are a quadruply nested data repeater, which is ugly
in its own right)
When the form first loads up, I populate a drop down list, set the
selected item to the first item, return my data for the selected item
in the drop down list, then build my table.
I am creating a few hidden controls in each row of the table to keep
track of some information.
I've been googling for days, and all of the viewstate articles I come
across usually deal with information not being persisted in
dynamically loaded controls.
However, my problem is just the opposite. Even though I set the value
of the hidden field in code everytime I rebuild the table, it
maintains the value that it had when the page first loaded up. I tried
setting the EnableViewState property for the hidden field to false
both before and after I add it to the controls collection to no avail.
The other interesting thing to note here is that my dynamically loaded
textboxes work fine, because when I load a different set of data, the
ID of the textbox changes, whereas the ID of the hidden fields stays
pretty much constant.
How can I prevent the value of my hidden fields from being overwritten
by the view state when I reload them?
Thanks!