Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 21, 2013 04:48 AM by Sankalpa
Mar 20, 2013 11:14 PM|LINK
I need to dynamically create multiple RadiobuttonLists in the code behind. On top of that, certain ListItems in each RadiobuttonList should also have a textbox next to it.
 option2 [TEXTBOX]
 option4 [TEXTBOX]
I have a SQL table which tells me each of the items to display in each RadiobuttonList, as well as whether they require a textbox.
How do I go about that in code behind?
I have this so far within a loop:
string cmd = "select * from tmpl_body_variable_options where P_NO = " + myvalue;
SqlCommand command1 = new SqlCommand(cmd, conn);
SqlDataAdapter adapter1 = new SqlDataAdapter(command1);
if (dt1.Rows.Count > 0)
for (int i = 0; i < dt1.Rows.Count; i++)
radioOption.Items.Add(new ListItem(dt1.Rows[i].ToString(), dt1.Rows[i].ToString()));
I know there are a few threads regarding this, but all of them requires only 1 textbox (next to 'Other') and are not required to be done dynamically.
Mar 21, 2013 04:48 AM|LINK
check this post