J
Jim Bancroft
Hi everyone,
I was wondering how best to dynamically add rows to an html table in
asp.net. I've been reading up on PlaceHolder controls in .Net, but every
time I add a new control to the collection it scrolls horizontally. I need
a vertical column.
Here's the ASP code I'm trying to port over. I've simplified it a little
for demonstration. Basically just looping through a recordset and adding
rows to a table, one for each record:
<table border="1">
<%if not (adoRecSet.bof and adoRecSet.eof) then
counter = 0
do while not adoRecSet.eof
%>
<tr>
<td>Display Name: <input type="text" width=15
name="<%="txtDisplayName" & counter%>"
value="<%=adoRecSet("tDisplayName")%>"></td>
</tr>
<%
adoRecSet.movenext
counter = counter + 1
loop
End if%>
</table>
I'd like to accomplish the same thing in .Net but can't figure how to do it.
One thought: is it possible to add a table to my PlaceHolder control and
then add rows from there? Thanks for your help.
-Jim
I was wondering how best to dynamically add rows to an html table in
asp.net. I've been reading up on PlaceHolder controls in .Net, but every
time I add a new control to the collection it scrolls horizontally. I need
a vertical column.
Here's the ASP code I'm trying to port over. I've simplified it a little
for demonstration. Basically just looping through a recordset and adding
rows to a table, one for each record:
<table border="1">
<%if not (adoRecSet.bof and adoRecSet.eof) then
counter = 0
do while not adoRecSet.eof
%>
<tr>
<td>Display Name: <input type="text" width=15
name="<%="txtDisplayName" & counter%>"
value="<%=adoRecSet("tDisplayName")%>"></td>
</tr>
<%
adoRecSet.movenext
counter = counter + 1
loop
End if%>
</table>
I'd like to accomplish the same thing in .Net but can't figure how to do it.
One thought: is it possible to add a table to my PlaceHolder control and
then add rows from there? Thanks for your help.
-Jim