This is a discussion on Inserting value to dropdownlistbox within the ASP and ASP.NET Programming forums, part of the Web Development category; Hello, I want to know how to add a text and a value for that text in the dropdownlistbox in ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hello, I want to know how to add a text and a value for that text in the dropdownlistbox in the dropdownbox's text and value property using code. Example: The dropdownlistbox will show the list of student names in the text and its value as their regno. -Kirubha Last edited by Kirubhananth : 02-14-2008 at 11:16 PM. |
| Sponsored Links |
| |||
| u can add like MyDropDownList.Items.Add(new ListItem("Selecy Country", "")); MyDropDownList.Items.Add(new ListItem("India", "IND")); MyDropDownList.Items.Add(new ListItem("United Kingdom", "UK")); MyDropDownList.Items.Add(new ListItem("United States", "US")); MyDropDownList.Items.Add(new ListItem("France", "FR")); MyDropDownList.Items.Add(new ListItem("Srilanka", "SR")); DropDownList.Items.Add(new ListItem("Selecy City", "")); |
| |||
| Hi, Using the above code u can add data dynamically. If u want to add the static values use the following in aspx page itself, <asp: DropDownList id="drop1" runat="server"> <asp :ListItem Text="C++" value="C++"/> <asp :ListItem Text="Java" value="Java"/> </asp: DropDownList> Last edited by poornima : 02-22-2008 at 10:42 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| inserting into table | ramesh123 | ASP and ASP.NET Programming | 1 | 02-14-2008 08:31 PM |
| Inserting An Array Into A Database using PHP | Sabari | PHP Programming | 3 | 12-18-2007 06:37 AM |
| DetailsView, inserting data from dropdown | Anandavinayagam | ASP and ASP.NET Programming | 5 | 12-06-2007 10:14 PM |
| example of Inserting and Retrieving data from xml file | hanusoft | ASP and ASP.NET Programming | 1 | 11-12-2007 05:13 AM |