ExtensionMethod.NET Home of 818 C#, Visual Basic, F# and Javascript extension methods

Add

Add an string array to ListControl ( dropdown, listbox, radiobuttonlist, checkbox).

Source

public static void Add(this ListItemCollection col, string[] array)
{
    foreach (string s in array)
    {
        col.Add(s);
    }
}

Example

DropDownList ddl = new DropDownList();
ddl.Items.Add(new string[] { "Apple", "orange", "Pair" });

Author: Matt G

Submitted on: 30 jul 2009

Language: C#

Type: System.Web.UI.WebControls.ListItemCollection

Views: 3300