Home
Manage Your Code
Snippet: Another way to add first item to ddl (C#)
Title: Another way to add first item to ddl Language: C#
Description: Another way to add first item to ddl Views: 429
Author: leno smith Date Added: 1/18/2008
Copy Code  
1//using RequiredValidator to prompt user if "select a item" is selected
2    private void BindDDL1()
3    {
4        ArrayList ar = new ArrayList();
5        ar.Add("jim");
6        ar.Add("jen");
7        ar.Add("june");
8        ar.Insert(0, "please select a name");//"please select a name" will be used in the "InitialValue" to prompt the user that he cant select this "initial value"
9        ddl1.DataSource = ar;
10        ddl1.DataBind();
11    }