I have a Table control, where I add controls to a new the cell, add this new cell to a new row and add this new row to the table.
Page renders fine. How can I have viewstate so that I don't have to call sql server again, get all the values, create new cells, rows and then add to the table?
How can I retain what has been added to the table, instead of re-creating the table all over again evertime there is a postback.
You must recreate the table in each postback, because the table content is created in each postback, then the table haves a similar behaviour to the dynamic controls... they need to be recreated on postback.
mavrick_101
so that I don't have to call sql server again
you can save the datatable in a session object or viewstate or other option.
Yes Mavrick , calling SQL server by queries and update table is needed in each postback. because you can't know when the user will leave the page except if there is a save button to confirm the operation.
In this case you can use an Updatepanel.
while(Experience<∞){foreach(var breath in life.Moments){Experience++; return "Above all science known";}}
mavrick_101
Member
96 Points
64 Posts
Dynamically adding rows and cells to the table.....
Sep 30, 2011 04:32 PM|LINK
Hi,
I have a Table control, where I add controls to a new the cell, add this new cell to a new row and add this new row to the table.
Page renders fine. How can I have viewstate so that I don't have to call sql server again, get all the values, create new cells, rows and then add to the table?
How can I retain what has been added to the table, instead of re-creating the table all over again evertime there is a postback.
Thnx
Segundo
Star
10892 Points
1567 Posts
Re: Dynamically adding rows and cells to the table.....
Oct 01, 2011 07:45 PM|LINK
Hi,
You must recreate the table in each postback, because the table content is created in each postback, then the table haves a similar behaviour to the dynamic controls... they need to be recreated on postback.
you can save the datatable in a session object or viewstate or other option.Any doubt, post your comment.
Blog: http://www.neuronasoft.net
Nazm
Participant
1760 Points
330 Posts
Re: Dynamically adding rows and cells to the table.....
Oct 01, 2011 08:13 PM|LINK
Yes Mavrick , calling SQL server by queries and update table is needed in each postback. because you can't know when the user will leave the page except if there is a save button to confirm the operation.
In this case you can use an Updatepanel.