Skip to Content
author's profile photo Former Member
Former Member

How to modify cells in a table?


This seems like a really stupid question but

how do I change a TableRows cells?

I have a Table, I have added some TableRows

TableRow tr = new TableRow();

tr = Table1.ItemTemplate;

<add cells>


in the bit in the middle I'd like to set some values but nothing I do works

Adding to the Cells adds columns to the table not cells to the row


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2004 at 05:07 PM

    Hi Vin,

    when you set tr to be the itemTemplate, from this point on you're actually working on the item template itself (reference, not copy..). So that's why adding cells adds rows.

    Just work on the new row you created without using the item template. Also you'll need to make sure you have the right number of cells as the header. The item template is used either to edit the columns, or as an actual template when data binding is done (to copy from).

    By the way - why do you do this in code? If you're just creating a manual table why not work with the designers ("edit columns" and "edit rows")?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.