473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

<asp:table...> and PostBack

Hey guys, I'm having a problem and need some help. I have an <asp:table ...>
in my web page, and this table has 2 rows, the first being a header row, and
the second row containing an <asp:button> to add rows to the table. Well,
when I add the first row it shows up, but if I try to add any more rows, the
one I added + the rest of them all disappear. I tried saving the table to a
Session variable, but that didn't work. I'm not really sure what is going
on, but any help would be appreciated.

CODE:
ASP:
<asp:table runat="server" id="InvolvementTable">
<asp:tablerow id="row1">
<asp:tableheadercell>Name</asp:tableheadercell>
<asp:tableheadercell>Details</asp:tableheadercell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell columnspan="2" horizontalalign="Center">
<asp:button runat="server" id="addRowButton" text="Add
Row"></asp:button>
</asp:tablecell>
</asp:tablerow>
</asp:table>

C#:

System.Web.UI.WebControls.TableRow r = new TableRow();
System.Web.UI.WebControls.TableCell c = new TableCell();
c.Text = "<input type=\"text\" size=\"30\" id=\"personInvolved" + count +
"\" />";
c.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
r.Cells.Add(c);
c = new TableCell();
c.Text = "<input type=\"text\" size=\"30\" id=\"personInvolvedDesc" + count
+ "\" />";
c.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
r.Cells.Add(c);
InvolvementTable.Rows.AddAt(InvolvementTable.Rows. Count-1, r);
Session["RowCount"] = ++count;
Session["InvolveTable"] = InvolvementTable;

--
If you can't beat them, arrange to have them beaten...
Nov 17 '05 #1
0 1607

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ed. | last post by:
I apologize if this is a stupid question. When working with the <asp:Table> component in design mode, how do you select controls placed in the table cells? I can only seem to click on the table...
0
by: Bryan Donaldson | last post by:
I have a table on my web form, declared like this: <asp:table id="tblOverrides" runat="server" enableviewstate=true" cssclass="clsTable"> <asp:tablerow cssclass="clsTblHeader"> <asp:tablecell ...
5
by: Ken Dopierala Jr. | last post by:
Hi, This is just a query about what people use most. Up until today I've been using <asp:Table> tags to build my tables. We just outsourced our HTML design to a local guy and when I got it back...
1
by: Dave Bennett | last post by:
I am hoping someone can help me because I am really beginning to hate IE. I am using the following code to generate a dynamic table. private void buildTable(ArrayList Products) { //Variables...
1
by: Rob Meade | last post by:
Hi all, I recently read a book regarding improving the performance of web pages loading, one of the suggestions was to add <colgroup> and the relevant <col> tags with information such as cell...
2
by: Roy | last post by:
Hey all, Quick question here. Within VS.NET there are various tags such as <asp:Table>, <asp:TableCell>, etc... which can be used in lieu of <Table>, <td>, etc... Why do such replacement tags...
3
by: Andy | last post by:
Hi folks, I have a customvalidator control that works properly if it isn't contained in an ASP:TABLE. But, when I place it inside an ASP:TABLE, I find that _ServerValidate doesn't get fired,...
4
by: Mark Rae | last post by:
Hi, Consider the following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
by: ckb | last post by:
Hi, This bit of code throws error Expected End of statement at line1 <asp:Table Width="100%" > <asp:TableRow id="T2r1"> <asp:TableCell id="T2r1c1" Width="85%"> <asp:PlaceHolder ID="PlaceHolder1"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.