Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vignesht50
Yak Posting Veteran
82 Posts |
Posted - 2013-11-15 : 02:33:59
|
Hi,I have a dropdown list with checkbox and when I select multiple options and search, its returning only the last selected value in the grid. Here is the code I use it for search. Designation is the column where I bind its values to the checkbox.Any suggestions or change in the select query?Checkbox tag:<asp:CheckBoxList ID="cblGroup" Style="vertical-align: baseline" runat="server" CssClass="chkbox"></asp:CheckBoxList>Select Query:SqlCommand cmd = new SqlCommand("select * from AppInvent_Test where Designation= '" + cblGroup.SelectedValue + "'", con); |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-11-15 : 05:27:52
|
Get comma separated values of checked items of CheckedListBox and pass on to the Where condition in the queryQuery:SqlCommand cmd = new SqlCommand("select * from AppInvent_Test where Designation IN ( '" + cblGroup.SelectedValue + "')", con);--Chandu |
 |
|
vignesht50
Yak Posting Veteran
82 Posts |
Posted - 2013-11-15 : 05:40:05
|
quote: Originally posted by bandi Get comma separated values of checked items of CheckedListBox and pass on to the Where condition in the queryQuery:SqlCommand cmd = new SqlCommand("select * from AppInvent_Test where Designation IN ( '" + cblGroup.SelectedValue + "')", con);--Chandu
Still I am able to see only one selected value. Not able to see multiple selected values. |
 |
|
|
|
|