asp.net - dynamically create radio buttons
is it possible to dynamically create radio button options that are dependent on a value within a database? For example 'b' is stored in a field so then 'a' will also be a radio button option, 'd' is st开发者_StackOverflowored in a database field so then the other radio button options will be 'a', 'b', 'c'....the radio button list will change depending on the value stored in the database field.
Hope this makes sense Thank you
This is C#, but VB is basically the same
foreach(string value in myStringsFromDatabase){
myRadioButtonList.Items.Add(new ListItem(value));
}
Once you have a RadioButtonList you can add items to it once you get them from your database. Since I have no idea what kind of database you have, I'll assume you can figure that part out.
精彩评论