Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Adding rows to a Tablecontrol does not save in viewstate

Reply
Thread Tools

Adding rows to a Tablecontrol does not save in viewstate

 
 
Allan Ebdrup
Guest
Posts: n/a
 
      10-03-2005
I'm Using ASP.Net 2.0 and VS2005 RC.
I've added a TableControl and a Wizard Control to my ASP.Net Page.
When i Click Finish on the wizard I do the following code:

TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.Text = "TEST";
tr.Cells.Add(tc);
Table1.Rows.Add(tr);

And a TEST row is added to the table, but when I jump back to step 1 of the
wizard or do anything else that reloads the page, the TEST row is deleted
again. I have enabled viewstate on the table control. Why is my test row
disappearing? And how can I make the TEST row stay, even after page reloads?

Kind Regards,
Allan Ebdrup


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      10-04-2005
Any controls that are dynamically added to the page must be added again upon
every postback.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> I'm Using ASP.Net 2.0 and VS2005 RC.
> I've added a TableControl and a Wizard Control to my ASP.Net Page.
> When i Click Finish on the wizard I do the following code:
> TableRow tr = new TableRow();
> TableCell tc = new TableCell();
> tc.Text = "TEST";
> tr.Cells.Add(tc);
> Table1.Rows.Add(tr);
> And a TEST row is added to the table, but when I jump back to step 1
> of the wizard or do anything else that reloads the page, the TEST row
> is deleted again. I have enabled viewstate on the table control. Why
> is my test row disappearing? And how can I make the TEST row stay,
> even after page reloads?
>
> Kind Regards,
> Allan Ebdrup



 
Reply With Quote
 
 
 
 
Allan Ebdrup
Guest
Posts: n/a
 
      10-05-2005
"Brock Allen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) .com...
> Any controls that are dynamically added to the page must be added again
> upon every postback.


Why does a table control have the option to enable viewstate then? it has no
viewstate. It the viewstate enabeling inherited to controls inside the
table?

Kind Regards,
Allan Ebdrup


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid rows not recreated from ViewState dc@upsize.de ASP .Net Web Controls 1 09-14-2006 07:39 AM
dynamically add new rows and save data typed in these rows to a database Arjen Hoekstra ASP .Net 0 08-02-2005 12:15 PM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM
script for moving rows up and down and traverse thru rows of HTML table Subba Rao via DotNetMonster.com ASP .Net 0 03-19-2005 06:46 AM
Dynamically adding different controls to different rows in DataGrid does not work Jonas ASP .Net Datagrid Control 0 09-23-2003 02:52 PM



Advertisments