Last post Apr 01, 2010 07:38 AM by Hua-Jun Li - MSFT
Mar 29, 2010 11:07 AM|hkbeer|LINK
Now my datasource has where clause depends on the selection of a dropdownlist that contains selection of one of the items plsu and option ALL.
This only caters for all or, one item
I need to make it
All, or, 2,3, or 4.. selection and the datasource is then refreshed. What control I should use and it seems the SQL need to modified into "IN" statement, am I wrong ?
Mar 29, 2010 11:25 AM|shashankgwl|LINK
i couldn't understand your question at all , all i can say that take a listbox instead of dropdownlist with multiselect
<asp:ListBox ID="ListBox1" runat="server" SelectionMode=Multiple></asp:ListBox>
Mar 29, 2010 11:26 AM|rtpHarry|LINK
There isnt a built in way to do this with a dropdownlist. You could do it with a ListBox control.
You can also get custom controls which put checkboxes in the dropdownlist.
This thread discusses some free options:
Mar 29, 2010 11:28 AM|mudassarkhan|LINK
Make use of ListBox Control
Mar 29, 2010 11:29 AM|Das.Sandeep|LINK
Mar 29, 2010 11:29 AM|MetalAsp.Net|LINK
You might make use of a ListBox which allows multiple selections. And yes, you will need to use an IN clause in your SQL.
Mar 29, 2010 11:41 AM|rtpHarry|LINK
something I didnt mention before is that the ListBox solution isn't very good unless you have a technical audience. Most people dont know that you can press ctrl down to make multiple selections.
If possible you need to change your UI so that you can use a list of checkboxes for multiselect.
Mar 29, 2010 11:55 AM|deepthoughts|LINK
There are also some jQuery plugins available that allow for multiselect dropdown..
Mar 29, 2010 02:04 PM|hkbeer|LINK
Thanks a lot.
I suppose the control parameter is a list box in my datsource.
What is the syntax of that ?
Apr 01, 2010 07:38 AM|Hua-Jun Li - MSFT|LINK
You must write your own control... the DropDownList which is found in the System.Web.UI.Controls will render a <select><option...><option...></select> HTML code and have no chance to add checkboxes to the <option> tags.
If you really need a multi-select dropdown, there's always
EasyListBox... it's also a heck of a lot easier, since to get the multiple select values, you just call the SelectedValue property and get a delimited string (there are other ways to handle the values as well if you like).
Please check the following link: