Using Repeater or DataList

jccorner

Centurion
Joined
Jan 31, 2004
Messages
144
Here's the deal:

I have a webform with twenty five lines each looking like:

Code:
Age: <textfield>     Gender: <combobox>  Status: <textfield>

My question is this, can I use a repeater to dynamically reference each text field or combobox ie.

Code:
<asp:textbox id="Age<%# num %>" runat="server"></asp:textbox>

That way it could save me a lot of cutting and pasting and from making various changes. The next question is can I build a link for each row dynamically?? If so, would you have any examples?? Thank you.
 
You are probably better looking at the DataList control, it will allow you to define an item template which contains the controls you want in each row and then databind it.
 
darker, I did find that webpage when I googled my problem, but what I'm trying to accomplish is to be able to take in information. I want to be able to list twenty-five textboxes and have a user enter the information and then have the information written into the db.

I might be overanalyzing this technique, but if I have the repeater "repeat" one textbox twenty-five times will it automatically name each textbox, textbox1, textbox2, textbox3 ...?? This is still a problem, because I have three columns on the page and will need to know the names of all seventy-five textboxes for coding reasons.

I must think someone else has run into this issue of someone filling out rows and rows of the same information on one form and having to spin through the data to enter into a db. Thank you for your help.
 
Back
Top