0
votes

I have a page with a number of dynamic RadiobuttonLists for users to select. Sometimes, there are textboxes next to the ListItems of each RadiobuttonList.

E.g.

(o) Listitem [textbox]

(o) Listitem2

(o) Listitem3 [textbox]

The way I coded is (pseudo code):

Foreach RadiobuttonList

RadioButtonList radioOption = new RadioButtonList();

name = "inputName" + i.ToString();    

radioOption.Items.Add(new ListItem("ListItem" + " <input id=\"" + name + "\" name=\"name\" type=\"text\" value=\"Enter text\" />"))

My question is, since the input textboxes are declared/created this way, how do I access the text the users enter in each of these textboxes?

How do I loop through all the input boxes and print out the details entered?

Thanks!

1

1 Answers

0
votes

Any inputs that are submitted to a Page can be accessed from the Request.Form collection.

You can get the value as follws:

var name = "inputName" + i.ToString();  
var listItemValue = Request.Form[name];