Create Dynamic Radio Button List Using XML
Posted on 2006-04-21
I'm writing a web user control that contains 3 RadioButtonList web controls in addition to other controls.
I would like to make this control reusable for different applications so instead of hard coding the radio buttons, I would like to dynamically add them when the form is loaded. In addition to setting up the radio button item text, I would also like to associate a stored proc name that would be executed when the radio button is selected. I was thinking that having this data in an external xml file would be the way to go since the xml file could be easily replaced/modified for other uses, and the user control would not need to be recompiled or redeployed.
I am *really* new at using xml, so I am not sure of the best way to form it for this use. It seems that each example I have found in my searches are all so different, that I am more confused than when I first started exploring this. I would like to be able to use the xmlReader to create the radio buttons and gather the proc name.
Please let me know if you can add radio buttons to a RadioButtonList in this fashion, and how to get started on forming the XML.
I'm using Visual Studio 2002 - with VB code behind for the .ascx file.
RadioButtonList1 (can have up to 12 items)
Map (calls sp_Map)
Class (calls sp_class)
Owner (calls sp_owner)
Street (calls sp_street)
Location (calls sp_Location)
RadioButtonList2 (can have up to 8 items)
Vacant (calls sp_vacant)