Click here to Skip to main content
15,891,785 members
Everything / Drop-down

Drop-down

drop-down

Great Reads

by Avelino Ferreira
The easiest way to implement the ToolStripControlHost and ToolStripDropDown classes, in a UserControl, in order to display a Container/Control beyond the limits of its Parent Container and Parent Form, with very few lines of code. Let's uncomplicate ...
by Puja Jagani
Using jTable instead of drop-down list.
by murtaza dhari
A generic dropdown control using LINQ to SQL and Entities using Reflection
by ASP.NET Community
Every time user’s complaints me about page scroll issues. For example: If a lengthy page having a dropdown list with AutoPostBack = true at bottom of

Latest Articles

by Robert Gustafson
Extended versions of ListBox and ComboBox controls which allow image, font, and colors for an individual item--along with multi-row/aligned-tab support for list box--and drop-down-list mouse-events/horizontal-scrollbar and custom drop-down buttons for combo box
by Evoluteur
A web color picker which looks like the one in Microsoft Office 2010
by Igor Krein
C# Extensions API for Entity Framework intended to simplify usage of drop-down lists, comboboxes and alike
by Avelino Ferreira
The easiest way to implement the ToolStripControlHost and ToolStripDropDown classes, in a UserControl, in order to display a Container/Control beyond the limits of its Parent Container and Parent Form, with very few lines of code. Let's uncomplicate ...

All Articles

Sort by Title

Drop-down 

28 Feb 2010 by Code-o-mat
Combo boxes under Windows have a "nice" feature of automatically selecting an item for the user when the user drops down the list of the combo box. This selection is based on partial string matching by the combo box, namely, it will select the first item in the list -if any- that begins with the...
22 Dec 2012 by rlilley
I am currently working on a project in Visual Studio 2012 that needs to send an existing file from one folder to my Dropbox public folder in zipped format, get the Dropbox public link and email the link to a list of users. I am having a problem getting the Dropbox Public LinkI have written a...
22 Dec 2012 by Zoltán Zörgő
As I see, you tried to wrap an application around some existing command line tools and IE. I suggest you look for and use dedicated .net libraries for those tasks.Like these ones: 1) ZIP: http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx[^]2) DropBox:...
22 Dec 2012 by BillWoodruff
I can see, by your response to my comment on your question, that you have already figured out the essential aspect of accessing files in your own DropBox, on your own computer.Yes, DropBox files in the Public folder, on your machine, use a hard-coded six-digit ID number; however, shared...
27 Aug 2013 by Member 8566049
Hi,I made a search on this but there is not much I could find.Hope someone overcame the similar problem.I have got a Parent Drop Drop Down list and two other drop down lists that are children.When I make a change on the parent, only one of them gets populated (IE). The other one...
26 Aug 2013 by Abhinav S
Tryhttp://www.aspdotnet-suresh.com/2011/01/introduction-here-i-will-explain-how-to.html[^]http://www.mikesdotnetting.com/Article/97/Cascading-DropDownLists-with-jQuery-and-ASP.NET[^]
27 Aug 2013 by Dholakiya Ankit
hi you can user separate pages for category,subcategories, section and if you want to use this then refer this linkshttp://www.asp.net/web-forms/tutorials/ajax-control-toolkit/cascadingdropdown/using-cascadingdropdown-with-a-database-cs[^]Cascading (Country,City)drop down list in...
1 Mar 2013 by gampapraveen
how to disable cascading drop down after binding.suppose i have 3 drop downs and i have binded data to it,now am selecting particular values to it.now i need to disable all selections to it.
1 Mar 2013 by gampapraveen
issue solved with codefunction Level1Populated() {$('#').attr('disabled', 'disabled');}function pageLoad(sender, args) {$find("ddlzo").add_populated(Level1Populated);}
16 Oct 2012 by Milan Mathew
I have asp.net page with dynamic dropdown controls and I need only the selectedIndexchanged event to fire only for the user selection.At present selectedIndexchanged event is firing for each programatically selection changes.Can some one suggest how to check/fire the selectedIndexchanged...
16 Oct 2012 by fjdiewornncalwe
If you are going to change the value programmatically, you can set a flag in your class that you check in the selectedIndexChanged event...private bool _iAmDoingSomething = false;private void DoSomething(){ _iAmDoingSomething = true; YourDropDownControl.SelectedIndex =...
16 Oct 2012 by Milan Mathew
The Solution provided by Marcus Kramer is working fine."Do something similar to this on the client-side with javascript where you effectively intercept the selectedindexchanged event for the dropdownlist and decide on the client side whether or not to let the postback occur. That is if you can...
24 Jul 2013 by shiv narayan (happyCoding)
I have textbox whose text is assign through checkbox item selectedusing javascript.I also have two dropdown whose value is interdependent each other which is assign through .cs server code in c#.while selecting dropdown value textbox value lost.how i retain textbox value ?????i...
24 Jul 2013 by Chui PuiKwan
where is txt_combo_international_location ?I advise that you check the aspx code after iis analysed and show it to us .
7 Jul 2011 by Dweatherford
I have a drop down list that has several options in it but I need to have a custom validator which does not allow the user to select 4 of the potential options in the drop down list. Any help would be greatly appreciated.
7 Jul 2011 by Sergey Alexandrovich Kryukov
First of all, even if you implement such behavior, it cannot be called "validator". A "validator" is something which validates data after it is entered, but you want to filter out the input (selection) itself.I fear to say such behavior is too far from expected UI behavior and would be very...
27 Jun 2012 by Member 8491154
I am fetching records from the database. I want that a particular record always comes as the last element. How can I do this?For eg: From database: A B C DBut, I want "B" to come always in last. I want this: A C D B
27 Jun 2012 by Member 8491154
Found the answer at:Link to answer
28 Jun 2012 by Savalia Manoj M
Hi,Please check this with example.create table #tbl(Name varchar(10))Insert into #tbl values('A')Insert into #tbl values('B')Insert into #tbl values('C')Insert into #tbl values('D')SELECT NameFROM #tblORDER BY CASE WHEN Name='B' THEN 1 ELSE 0 ENDDrop table #tbl
28 Jun 2012 by MikaelaOnorata
Hi,Bind all the items to DropDownList except you need to see it at last and then at the end you can add that Item.Suppose : A,B,C,D and you need CSo add a,c,and D thenDdl.items.Insert(ddlites.items.count,C);Thankswww.alacraft.com.au
2 Jul 2015 by DrABELL
DropDownList Data Binding to Array (1D/2D), Enum and Dictionary objects in .NET
8 Aug 2015 by Member 11011853
Hello...im trying to bind data from sqlserver database to dropdownlist placed in content/child page using jquery. I referred many articles, they specified only for plain webform, not to content pages.Its working fine in plain webform, and not in child pages...! my code is :
21 Dec 2011 by Rajesh Kumar Chekuri
Binding DropDownList Using List Collection, Enum and DataSet in ASP.NET
6 Apr 2012 by pradeep manne
hi all,i want to bind the output of the select query to the dropdownlistexample i need only the year part fron the date column"select year(date) from table" .i need the only year part to be binded to the Dropdownhow can i do this Thanks Inadvance
6 Apr 2012 by Reza Ahmadi
Hi,If you provide the Date part before binding, I mean in your Query, then binding code is very simple:
17 Dec 2012 by sethwcaton
I'm using the exact code snippet (Step 1 of the Simple Version) from this page hosted by the developers of BreezingForms for Joomla! CMS, modified only to have the correct table and field names, and the name of the select list in the form:...
24 Nov 2013 by Diya Ayesa
TRYING TO SEND mail with document name and then value which admin select from dropdown like approve/reject/pending for this i try this codeLabel DocName = ((Label)Repeater2.Items[i].FindControl("DocName"));DropDownList dropdownvalue...
24 Nov 2013 by John Korondy
Your inaptly named "dropdownvalue" is of type DropDownList which cannot be assigned a string. Did you meandropdownvalue.SelectedItem.Value = "2" // RejectIn your DropDownList4 (again, can this have a better name, like DropDownApprovalStatus) has possible values of 1, 2 and 3 corresponding...
24 Nov 2013 by CHill60
dropdownvalue is a DropDownList object. You can't assign a string to it, that would be meaningless. What you are actually trying to do is change the .Text displayed on the control, so try something like ... dropdownvalue.Text = "Unavailable".Note this will only work if "Unavailable" is...
24 Nov 2013 by pradiprenushe
Type of dropdownvalue is DropDownList. So you can not set string to dropdownlist. I think you user wrong variable.Try thisif (dropdownvalue.SelectedItem.ToString() != ""){ dropdownvalues = dropdownvalue.SelectedItem.ToString();}else{ dropdownvalues = "Unavailable";}
1 Aug 2012 by ajithk444
Hi I'm developing a registration form with Country and city name .I need the city to be loaded in the dropdown list based on the selection in country dropdownlist.pls help me with this about what are all the code i should write in c# and help me with the SQL statements also for the records.I...
1 Aug 2012 by virang_21
Try something on your own first ... To start with check AJAX Control toolkit cascadingDropDown examplehttp://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx[^]
1 Aug 2012 by Vani Kulkarni
Did you try searching Google[^] before posting your question here? It returned About 133,000 results (0.40 seconds) for your query. Try using google first.Top results for your query, Web form scenario:Using CascadingDropDown with a...
1 Aug 2012 by Prasad_Kulkarni
ASP.NET cascading drop-down-list (CSASPNETCascadingDropDownList)[^]CascadingDropDown Demonstration[^]Cascading DropDownList in ASP.NET MVC[^]Creating Cascading DropDownLists in ASP.Net[^]Using CascadingDropDown with a Database[^]Get more on CP Search[^]
1 Aug 2012 by ajithk444
hi, i solved it. this was the code.thanks for all the help... public void Bind_ddlCountry() { SqlConObject.Open(); SqlCommand cmd = new SqlCommand("sp_Country", SqlConObject); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr =...
27 May 2013 by Naufel Basheer
Implementation of MVC3 Cascading Dropdown using jQuery[^]
28 Feb 2012 by Rajjjjjjj
Hi all, I am working with gridview control in my form. I placed two dropdowns in two fields of gridview.Now i want to fill the second dropdown(inside gridviw collumn) based on the selection of the item in the first dropdown.I am unable to use If condition in the...
3 Mar 2012 by thatraja
Check thisAjax Cascading DropDownList With Database Example in GridView[^]
28 Sep 2015 by Member 11999641
hi, I got a drop down list. User upon selecting different value, I should get the option text of the option user has selected from the dropdown list, then go find the data from the database and display the relevant content on the webpage. If user change the option again, I should go retrieve...
29 Sep 2015 by Sreekanth Mothukuru
Check the two links below on how to change page content based on the drop down select change. You need to use jQuery ajax $.Get methods to get data from the...
14 Jan 2013 by Ben Matheson
HelloI have a Drop Down List in a web page, what it currently does is displays an individual image that is selected in the list.Please find my code below.What I want to achieve is if a sector is selected such as pubs for example, It will display a group of images of pubs instead of...
19 Jan 2013 by vinodkumarnie
If you want display group of images to shown on selection of dropdownlist you should create images dynamically by assigning related image path.. university
16 Nov 2012 by Mac12334
Hi allMy Dropdown Id is automatically changed to some letter with my setted id.But I don't want to change the ID.I searched in google and found this linkClientIDModeThis is not working for my dropdown.Is there any other way to made the ID static.Please HelpThanks In...
16 Nov 2012 by anil.luck
If you are getting problem for doing jQuery stuff due the id changeThen you can this solution$('[id*="drpId"]').change(function () { /*Your code*/ });
18 Nov 2012 by deepak.m.shrma
You can do it in jquery like this. its working well.$("#").change(function(){//do sumthing});
2 Oct 2020 by Evoluteur
A web color picker which looks like the one in Microsoft Office 2010
4 Aug 2020 by Member 11396175
Good morning I think my question is very simple for your experience one combobox with specific path give me the folders that have in it I want when i select one folder from combobox the files in the folder placed in the list box. What I have...
8 Aug 2020 by Sandeep Mewara
Code in combobox selected change would be roughly: String[] files = System.IO.Directory.GetFiles("combobox selected path of folder"); for (i = 0; i
4 Aug 2020 by TheRealSteveJudge
First of all you must cast "sender" which is just an object to "ComboBox". Then you must get "SelectedValue". Finally you must get the files that are in the selected directory and use it as data source for the ListBox. private void...
4 Aug 2020 by Richard MacCutchan
See Path.GetFileName Method (System.IO) | Microsoft Docs[^].
7 Nov 2013 by Adam Zgagacz
ComboBox extension methods for binding with Enum types
16 Mar 2012 by yl2rox
I have included two Dropdown-lists inside an UpdatePanel. First Dropdown-list contains a list of Departments. What I want to do is, when the user selects a department, the second Dropdown-list should be populated with the list of employees work in that particular department.I have used an...
16 Mar 2012 by Prabhakaran Soundarapandian
Add the below code inside your update panel
1 Nov 2012 by Kailas Mane
Create a multiple clolumn combox/autocomplete/dropdownlist in ASP.NET MVC3.
16 Jan 2012 by Boon How
Hi, I am new to programming and trying to figure out how to set up a auto populated drop down list for year.I am trying to set up a drop list of years, starting from 2009 to current year. I have tried to use the code below but it failed. Can someone please help me to look into the coding...
16 Jan 2012 by Prerak Patel
As Om Prakash said, you should put this code in Form_Load or Control_Load event.Just like,Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load cbo_StartYear.Items.Clear() 'CLEAR THE LIST FIRST Dim currentYear As Integer =...
30 Mar 2010 by Mohd Arshad Malik
This article is about to create a chained drop down list when we want to represent data from hierarchical data sets.
26 Mar 2012 by JammoD87
Hi,I've been looking online for a while now and im sure there is going to be a very simple answer to this one. But I have a bit of code which is used in quite a few pages on our ASP.Net Application, and I would like to place it into a method/class so that I can use it throughout. Here is...
26 Mar 2012 by Not Active
Create the method in your business layer and return a datasource that can be used to bind the controls in your UI. Many people try to create similar methods and pass the control to be populated as a parameter but that doesn't allow for the loose coupling an application needs for flexibility and...
26 Mar 2012 by Kschuler
Well...you already have it in a method...so....since you didn't really specify it's hard to know for sure what you're asking here.I'll assume that this code is used in other places but for a different drop down? If that is the case, instead of using ddlSPBusinessPDVResult you'll want to...
26 Mar 2012 by Shahin Khorshidnia
HelloYou can just use the value of session instead of sessionfor example:Public Function PopulateResults(groupID As String ... and somethings else) As String '... Try '... 'At the last line of Try: Return String.Empty Catch ex As Exception 'Session["Error"] =...
15 Jan 2013 by EricFaust
A custom made DropDownList control for ASP.NET
19 Sep 2011 by qwerty 2
Hi all,I want to keep dropdown list column in the template field of a header and would like filter the data based on the options selected in the dropdown list of header column in the data grid..but not single row filtering,Its on the header where i need to filter the data with regard to a...
19 Sep 2011 by Tejas Vaishnav
Hello friend you need this changes1) set the autopostback property = true in header drop down2) generate a SelectedIndexChanged event of that drop down event3) in that event you have to write your code that will filter your data and that data will be reassign to your grid to re bind it...
2 May 2013 by Njl Eye
Dear Expert,I have database in which i have a table which has following;Telphone No.Name of CustomerAddressRecovery Jan,Recovery Feb,Recovery Mar, and so on....actually we retrieve the record from telephone numbers each number has different customer name and other details,...
9 Aug 2011 by patelKhyati
i have several dropdown lists in my asp.net c# project.i have set default value say "choose one" in drop down list and aslo set a validator for that dropdownlist.my problem is on buttonclick event my validator does not fire for the dropdownl list and also the default value "choose one"...
9 Aug 2011 by dan!sh
If it is a RequiredFieldValidator, set it's InitialValue property to "choose one". This way, validator will show error if nothing is selected in the dropdown. If you are using any other validator, let us know.
9 Aug 2011 by mahabubur rahman
set the datasource of dropdownlist after that write a code belowdropDownList.Items.Insert(0, new ListItem("--choose one--", "0"));exampledropDownList.DataSource = List.ToString();dropDownList.DataBind();dropDownList.Items.Insert(0, new ListItem("-- choose one--", "0"));
9 Aug 2011 by Soft009
void BinddatatoCombo(){ comboBox.DataSource = null; comboBox.DisplayMember = "Name";//Display in Combo box comboBox.ValueMember = "ID"; DataSet myds = null; myds = GetDataSet("SELECT * FROM...
9 Aug 2011 by the headless nick
Method 1ListItem itm = new ListItem();itm.Text = "";itm.Value = "-1";itm.Selected = true;DropDownList1.Items.Insert(0, itm);Method 2 (dat I prefer)DropDownList1.Items.Add(new ListItem("- Select -", "-1"));Also you can check...
10 Aug 2011 by sujit0761
--Choose one-- Option 1 Option 2 Add a value field to each list item. And in the required fiels validator set the Initial Value to 0. This will help you to validate your dropdown and the "Choose one..." will not be sent to DB.Hope this will help you!!!
26 Oct 2013 by aravindnass
heyy....Iam using ajax jquery to fill a dropdownlist ,The dropdown is fill but when a get the value of dropdownlist from code (ddl.selectedvalue) . I didn't get that value ...Here is my jquery to fill dropdownlist - ...
27 Oct 2013 by Mahesh Bailwal
As you are adding values on client side you won't be able to get selected value through ddl.selectedvalue as sever is not aware about new values added through Jquery. So in this case you need to fetch value from Request object like belowstring seletVal = Request[ddl.UniqueID]
22 Mar 2010 by am.net
Hi to all, i need to create drop-down list in asp.net with items, which display all items but some of them disable for select.e.g public void fillDrp() { drp1.Items.Clear(); drp1.Items.Add(new ListItem("a", "1", true)); drp1.Items.Add(new ListItem("b", "2",...
22 Mar 2010 by Christian Graus
I am pretty much certain that what you want is impossible using HTML, which means it's impossible in ASP.NET. The best you can do, is to write javascript that detects when something in your blacklist is selected, and unselected it.
22 Mar 2010 by vinod malla
hi friendfor this type we should write a javascript like function change() { var dd=document.getElementById (";'); var value=dd.options[dd.selectedIndex].value; if(value!=your disabled index) { do what you...
12 Jun 2011 by RossIV
Hello!I have a basic form setup in an html file. What I want to do is if a user selects a specific option in a dropdown box, then display an additional field on the page. Is this possible?Thanks!Ross
12 Jun 2011 by Sandeep Mewara
Yes, very much possible. For example, if you select 'Others' as an option in the select then a textbox needs to be shown where one can fill any description of other if needed. You need to do:1. Attach a Javascript 'onchange' handler for the select2. Whenever anything is selected the...
22 Nov 2010 by rpriyank007
I have a table EMP_TAB with columns as NAME, ADDRESS, CITY, PHONE.I want something like this:I have bound a gridview with the datasource of above table, EMP_TABWhen I click on EDIT in gridview than instead of a textbox, I want a dropdownlist to be displayed for changing the CITY.The...
22 Nov 2010 by Sunasara Imdadhusen
HiYou should use Refer following link:GridView Examples for ASP.NET 2.0: Editing the Underlying Data in a GridView[^]Please do let me know, if you have any...
30 Jun 2012 by sadegh_rusta
i do bind data to adropdownlistand i want show details by select a item of this dropdownlistbut when is page load first item is first row of my tablei dont have accour thisi want show me null value ,in first row of dropdownlist on the page load
30 Jun 2012 by AshishChaudha
Follow the below codedropList1.Items.Insert(0, new ListItem(String.Empty, String.Empty));dropList1.SelectedIndex = 0;make it answer if this is your solution. dont forget to rate the solution.Thanks
4 May 2017 by H.AL
I am trying to create a responsive website. I am using bootstrap 3.3.7 and jquery 3.2.0 with visual studio 2010 vb.net. Now I am trying to create a navigation bar with a dropdown menu. I want to add animation to this menu so I worked as first step with css by adding this to class dropdown and...
23 Nov 2013 by kesav aggarwal
I have seen that drop-down lists on IE10 looks very sleek when opened and on some sites the dropped menu is over the select item like in the following page.Demo Here[^].. open this link in IE7,8,9,10.How can i create the same for firefox and chrome?
18 Jun 2013 by Sagar Gulati
This is my Model:public class TeamRosterModel { public SelectList ManageList { get; set; } public string Command { get; set; } } public class Employee { public string FromEmpID { get; set; } public string EmployeeName { get; set; } ...
18 Jun 2013 by Christian Graus
You should use DropDownListFor, that will let you assign the collection AND a variable to store the selected value.Otherwise you have to pull it out of the Request. You might be able to create a variable and have it auto populate, but you're better off letting the framework know ahead of...
1 Mar 2012 by summerrain_90
i have a Drop Down List called "drop_category" like: -Category1 -Category2 -Category3 -Category4 -Add new categoryand i want the web will open a popup when user select item "Add new category"i trieddrop_category.Items.FindByText("Add new...
1 Mar 2012 by Subinal
Use the onChange event of thr drop_category and use the selectedIndex to find if its the selected item.drop_category.Attributes.Add("onChange", "newCate();");in the code behind and in the jsfunction newCate() {var e = document.getElementById('ctl00__drop_category'); ...
15 Oct 2013 by Neily1982
I am new to programming and am trying to fill the 2nd drop down using selected value of the first. But I cant seem to the second drop down to fill with data Can someone show me where I am going wrong?protected void Page_Load(object sender, EventArgs e) { { ...
15 Oct 2013 by Salman622
just check autoPostback property of ddCompanyif you have not set then set it as AutoPostback="true" in aspx pageand in your page load event write all your bussiness logic as below protected void Page_Load(object sender, EventArgs e) {if(!Ispostback){//your code;}}
15 Oct 2013 by Ankur\m/
Based on the discussion with the OP,1st DropDownList's AutoPostBack[^] property was not set to true. That is why nothing was happening on changing it. Setting it to true solved the issue.
5 Jul 2013 by jagdish123061
I have one drop down list in update panel but when I assign any value to ddl.selectedValue it is not selecting that value for eg.ddl.selectedValue=2then it remains nulli had check it using break point it is not changing to 2.please help me......
5 Jul 2013 by Mahesh_Bhosale
hay jagdish,Change your dropdownlist properties AutoPostBack : Trueits work..
5 Jul 2013 by jagdish123061
I found that it was databinding error. data was not bound to ddl therefore selected value was empty.thanx to u all for reply...
6 Jul 2013 by KuttiSankar
I think you can give the property in design page itself. first value second value
20 Sep 2012 by itskvini
I am setting selected item of one drop down according to the value of other drop down through javascript.But I am not getting this selected item value in code behind.Finally I used Hidden Field for setting the drop down value and then used this hidden field value in code behind.Can any...
21 Sep 2012 by Krishna Kishore Biyyam
Have you enabled view state of the dropdown?if not set "EnableViewState=true" for the control.
21 Sep 2012 by PBGuy
I think u have ur fill drop down method in page load, instead of !ispostback, check it once
10 Jun 2015 by Lalyka
when I open the dropdowncheckbox and click "Select all" it selects all and when I uncheck Select all it unchecks all but when I want to check Select all again, it does not check all the optionsI Have a DropDownCheckBoxes