Slide 14.2: The ArrayList object
Slide 14.4: The Hashtable object
Home

The ArrayList Object (Cont.)


Data Binding to an ArrayList
An ArrayList object may generate the text and values to the controls: To bind data to a RadioButtonList control, first create a RadioButtonList control (without any asp:ListItem elements) in a page:
 <asp:RadioButtonList id="rb" AutoPostBack="True" 
   onSelectedIndexChanged="DisplayMessage" runat="server" />
Then add the script that builds the list and binds the values in the list to the RadioButtonList. The DataSource property of the RadioButtonList is set to the ArrayList and it defines the data source of the RadioButtonList. The DataBind method of the RadioButtonList control binds the data source with the RadioButtonList.