By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,373 Members | 1,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,373 IT Pros & Developers. It's quick & easy.

Draw html with loop?

P: n/a
Rob
I am new to ASP.NET and am trying to convert an old ASP project to a C# web
application. I have a page with a very long form on. On part of the form
has a series of comboboxes that a populated with data from a database. In
my old ASP project I wrote the HTML doing something like this

<% for i = 1 to 10 %>
<tr>
<td><select name='test'><option value='<%= i %></option><.select></td>
</tr>
<%next%>

This is not the exact code an is abbreviated just for this post. How do I
do something similar in .NET? Also, is there a way of doing this with a set
of radio buttons with having to use the radiobuttonlist control? I think
the design options are a little limited for this control.

Thanks.

Rob
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can do exactly the same thing if you are using inline code. That would
be the easy way for a quick conversion. Or call a function inline, and have
the Response.Write() calls in the function.

Otherwise, use one of the bindable controls (repeater, datalist, etc), and
either add rows to the datalist in a loop or make a collection or array and
bind to the list.

Jeffrey Palermo

"Rob" <ro*@nospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am new to ASP.NET and am trying to convert an old ASP project to a C# web application. I have a page with a very long form on. On part of the form
has a series of comboboxes that a populated with data from a database. In
my old ASP project I wrote the HTML doing something like this

<% for i = 1 to 10 %>
<tr>
<td><select name='test'><option value='<%= i %></option><.select></td>
</tr>
<%next%>

This is not the exact code an is abbreviated just for this post. How do I
do something similar in .NET? Also, is there a way of doing this with a set of radio buttons with having to use the radiobuttonlist control? I think
the design options are a little limited for this control.

Thanks.

Rob

Nov 18 '05 #2

P: n/a
Use a DataList, DataTable or DataRepeater Control.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Rob" <ro*@nospam.com> wrote in message
news:#e**************@tk2msftngp13.phx.gbl...
I am new to ASP.NET and am trying to convert an old ASP project to a C# web application. I have a page with a very long form on. On part of the form
has a series of comboboxes that a populated with data from a database. In
my old ASP project I wrote the HTML doing something like this

<% for i = 1 to 10 %>
<tr>
<td><select name='test'><option value='<%= i %></option><.select></td>
</tr>
<%next%>

This is not the exact code an is abbreviated just for this post. How do I
do something similar in .NET? Also, is there a way of doing this with a set of radio buttons with having to use the radiobuttonlist control? I think
the design options are a little limited for this control.

Thanks.

Rob

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.