Looping through controls
How can I make a for loop that shows a group of asp radiobuttons to the user?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Oct 20, 2009, 3:25 PM
llike below code
<%
for (int i = 0; i <= 10; i++)
{
RadioButton rb = new RadioButton();
rb.ID = "RadioButton" + i.ToString();
rb.Text = "RadioButton" + i.ToString();
Page.Form.Controls.Add(rb);
}
%>
Kirtan PatelPosted Oct 20, 2009, 3:36 PM
you can also place whole page_load function in
patrickPosted Oct 20, 2009, 3:30 PM
patrickPosted Oct 20, 2009, 3:11 PM
Kirtan PatelPosted Oct 20, 2009, 3:09 PM
for (int i = 0; i <= 10; i++)
{
RadioButton rb = new RadioButton();
rb.ID = "RadioButton" + i.ToString();
rb.Text = "RadioButton" + i.ToString();
Page.Form.Controls.Add(rb);
}
patrickPosted Oct 20, 2009, 3:05 PM
Master BillaPosted Oct 19, 2009, 9:07 PM
You can do this way, just add a panel, then create a radioButtonlist control, then add your repeating wrod as like item to radiobuttonlist,
finally add the radio button list to panel.
thank you
Kirtan PatelPosted Oct 19, 2009, 5:33 PM
mail id = [email protected]
if you can explain here mail me :)
patrickPosted Oct 19, 2009, 5:30 PM
patrickPosted Oct 19, 2009, 5:27 PM
Roei BarPosted Oct 19, 2009, 5:26 PM
put an asp panel
and in code behind
for (i=0;i<5;i++)
{
this.pnlRadio.Controls.Add(new RadioButton());
}
Kirtan PatelPosted Oct 19, 2009, 5:01 PM
what do you mean by showing gorup of radio buttons ??? ?