Using for loop at design side to create rows and column, defined by the user

Bhavna81
Posted by Bhavna81 under ASP.NET category on | Views : 3023
Hello every body,
This code help you to create more then one row, column and table using for loop.
Here no need to write tags more then one time .

[code]
<body>
<form id="form1" runat="server">
<table width="30%" border="3">
<tr>
<td style="width:10%" align="center">
Roll No.
</td>
<td style="width:40%" align="center">
Name
</td>
</tr>
<%for (int i = 1; i <= 5; i++)
{
ArrayList s1 = new ArrayList { "Bhavna", "Sandhya", "Seema", "Prity", "Tejal" };%>

<tr>
<td align="center">
<% Response.Write(i); %>
</td>
<td>
<% Response.Write(s1[i-1]); %>
</td>
</tr>
<%} %>
</table>
</form>
</body>
[/code]


thanks.

Comments or Responses

Login to post response