Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have 5 checkboxes with color name (red,blue,green,yellow,black) in asp.net page. its mobile cover color page.
i display products using datalist.

now, like when user select green and yellow then i want to display only green and yellow covor. if user select 3 color then i want to display mobile cover according to user selection.

i used below code and then i dont know what to do...
if (CheckBox1.Checked==true)
        {
            
            da = new SqlDataAdapter("SELECT * FROM Product where color='" + "red" + "'", cn);
            ds = new DataSet();
            da.Fill(ds);
            DataList1.DataSource = ds;
            DataList1.DataBind();
            
        }
Posted
Updated 11-Dec-17 19:47pm
v2
Comments
Amit Jadli 10-Sep-15 4:27am    
Not clear what u r trying to explain..
Member 11422010 10-Sep-15 5:48am    
i am trying to search data as per user selection.

you can call quesry on every checkboxnaged event or use jquery/Ajax to filter the option
 
Share this answer
 
Comments
Member 11422010 10-Sep-15 5:49am    
yes you are right but i gave only 6 color but it would be dynamic.
sandeep Nishad 11-Sep-15 0:17am    
use cheackbox list to bind colors
use checkboxlist to bind color , you can get selectedcheckbox value/Text than you use within query.




If Answer Help You Please Mark as solution .
 
Share this answer
 
v2
Comments
/\jmot 12-Sep-15 11:44am    
this answer nothing gonna help the user, you need to add clear descriptor with sample code which can help the user, so, improve your question.
Hi ,
you can call query on checkbox changed event like

C#
protected virtual void OnCheckedChanged(
    EventArgs e
)



or also you can maintain checkbox selection array and call your query.

i hope this solution is helpful

Uttam
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900