| | |
Dropdown list Last value
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
I fill dropdown lists values from the database then I wants to hard code first value and last value. I already hard code first value it's like this.
cboName.Items.Insert(0,new ListItem("----Select----","0"));
how can I hard code last value of the dropdown list, I want to add last value as a ----Other----. can anyone help me?
Thanks.
cboName.Items.Insert(0,new ListItem("----Select----","0"));
how can I hard code last value of the dropdown list, I want to add last value as a ----Other----. can anyone help me?
Thanks.
•
•
Join Date: Jul 2006
Posts: 47
Reputation:
Solved Threads: 0
I believe you can also do the following:
cboName.Items.Add(new listitem("Other","0"))
'item_name' would be the name of the item you want to add
And, another option for hard-coding the first entry, or the first several entries is to add the entries on the actual .aspx page in the <asp:listitem> tags, and then set the cboName's AppendDataBoundItems property to true. Though that's just a personal preference.
cboName.Items.Add(new listitem("Other","0"))
'item_name' would be the name of the item you want to add
And, another option for hard-coding the first entry, or the first several entries is to add the entries on the actual .aspx page in the <asp:listitem> tags, and then set the cboName's AppendDataBoundItems property to true. Though that's just a personal preference.
![]() |
Similar Threads
- Dropdown list in ASP.NET - How to get value selected (ASP.NET)
- Dynamic dropdown list (ASP.NET)
- hi problem in dropdown list (ASP)
- Retrieving Multiple Columns into Dropdown List (ASP.NET)
- DropDown List (VB.NET)
- Feeding a value in a dropdown list to another dropdown list (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Batch file in ASP.Net to convert Excel files into higher version
- Next Thread: its a challenge... but i am stuck!!!
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu dynamically edit fill flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list listbox menu microsoft mono mouse mssql multistepregistration nameisnotdeclared news numerical objects opera order panelmasterpagebuttoncontrols radio ratings registration reportemail rotatepage schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





