creating asptable rows programatically

chand

Freshman
Joined
Feb 4, 2004
Messages
30
Hi

I want to generate asptable rows and cells programatically.i created two
divisions in html row then i placed the asp:table with id in each division like below
<table>
<tr>
<td style="WIDTH: 324px; HEIGHT: 168px" colSpan="1">
<div id="divA" runat="server">
<asp:Table ID="Table1" Runat="server">
</asp:Table>
</div>
</td>
<td style="WIDTH: 324px; HEIGHT: 168px" colSpan="1">
<div id="Div1" runat="server">
<asp:Table ID="Table2" Runat="server"></asp:Table>
</div>
</td></tr></table>

I have checkboxlist in previous page depends on user selects i need to
generate rows and cells
with different labels and values.
in one division we can have like
name "AAAAAAAA"
state "MO"
city "KKK"
in another division like
name "BBBBBB"
zip "50234"
County "LLLL"

user can select to see two types of first division info or user can select
one each.if user selects two types of first division info or each one division info then i need to show side by side.

I would appreciate any help or giving some articles about it or is there anyway todo this.

Thnaks
 
Here is one way of adding rows and cells programatically:

Code:
Dim i, j As Integer
For i = 0 To 9
    Dim tr As New TableRow()
    For j = 0 To 4
        Dim tc As New TableCell()
        tc.Text = "Row:" & i & ", Col:" & j
        tr.Cells.Add(tc)
    Next
    Table1.Rows.Add(tr)
Next
 
still i hv one more question

i need to change cell text too like
id ,name,state
in other asptable
id,name,county
depends on user selects
 
In the above code, tc is declared as a TableCell. So tc.Text is the content/text of the cell. I thought the code was clear enough so I didn't comment it. :confused:
 
Back
Top