Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2004, 09:54 AM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding rows to a table in ASP.NET codebehind

Hi,
I am able to add rows to a asp:Table server object in the codebehind. The process outputs the correct html just fine. But when the postback is triggered, this table's rows.count still shows the old value, as if the rows that were on the page were never added. I am obviously missing some code that updates page collection or renders something. Please help!
Thank you in advance!
 
Old July 22nd, 2004, 08:35 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This type of information is not maintained automatically by .NET. You need to regenerate the additional rows every time. If you are generating the rows based on some event or database call, you need to persist the information manually in order to regenerate the rows.
 
Old August 3rd, 2004, 02:56 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

declare your Table object as a static global object
-----
public class WebForm1 : System.Web.UI.Page
{
     static Table tbl=new Table();
     //......add your rows and cells evrywhere you want
}
-----
HTH.

--------------------------------------------
Mehdi.





Similar Threads
Thread Thread Starter Forum Replies Last Post
keep adding table rows on button click wlin ASP.NET 2.0 Basics 0 September 26th, 2006 02:14 PM
Deleting Excel Rows using ASP.net (C#) ctranjith General .NET 0 August 3rd, 2005 01:51 AM
page take time to load after adding rows in table avanishp General .NET 5 June 21st, 2005 02:32 PM
Adding a New Table to a Database with ADO.NET Aaron Edwards ADO.NET 4 December 26th, 2004 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.