The ArrayList object is a collection of items containing a single data value.
The ArrayList object is a collection of items containing a single data value.
Items are added to the ArrayList with the Add() method.
The following code creates a new ArrayList object named mycountries and four items are added:
By default, an ArrayList object contains 16 entries. An ArrayList can be sized to its final size with the TrimToSize() method:
An ArrayList can also be sorted alphabetically or numerically with the Sort() method:
To sort in reverse order, apply the Reverse() method after the Sort() method:
An ArrayList object may automatically generate the text and values to the following controls:
To bind data to a RadioButtonList control, first create a RadioButtonList control (without any asp:ListItem elements) in an .aspx page:
Then add the script that builds the list and binds the values in the list to the RadioButtonList control:
The DataSource property of the RadioButtonList control is set to the ArrayList and it defines the data source of the RadioButtonList control. The DataBind() method of the RadioButtonList control binds the data source with the RadioButtonList control.
Note: The data values are used as both the Text and Value properties for the control. To add Values that are different from the Text, use either the Hashtable object or the SortedList object.
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.