Viewstate of Dynamically Generated Table Rowss ??

G

Guest

With an ASP page you can add a webform textbox and button (ie not HTML ones)
an cause something to be appended to the textbox everytime the button is
presssed because the textbox Enableviewstate property is true (??)

I have created a webform table and have modified code from MSDN (Jan)
library such that when a button is pressed, rows are appended. I have
programmatically enabled viewstate for the cells and the row added. The
problem is that each time the button is pressed the previusly added rows are
lost; ie no viewstate.

<For the dynamic table code search in MSDN library for TableRow class and
take the Overview. Note that this code has the script in the HTML section
interacting with a HTML table. With little effort it can be co-opted to
interact with a webform table placed in an ASPX code behind page>

Any ideas ?? Thx
--
David Jones
Senior Lecturer
School of Electrical & Computer Engineering
RMIT University
+61 3 99255318
 
K

Karl Seguin

David:
You need to recreate table rows and cells..So when the button is clicked
once, you add the row/cells. When it's clicked a 2nd time, you add the
initial row/cell and then the new row/cell....and so on. Typically you keep
track of how many times the button is clicked by keeping a value in the
viewstate.

You can use denis bauer's DynamicPlaceHolder
(http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx,
free) but the site has been done for a couple days (it's always up and
down).

karl
 
G

Guest

Thanks for that.
On reading elsewhere I had a fely that was the case.

What a bummer though.
It means that you have maintain the state (content) of those added controls
yourself.
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top