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

I have a ASP.net page, which contains 6 check boxes.
The user might sometimes check one box, 2boxes... upto 6 boxes.

when user checks more than one box, we have combinations of boxes

When ever such selections are made, i need to retrieve data from sql database, for this i need to write dynamic query, where the paramters keep changing

If we try in conventional methods, the number of queries tht i need to write reaches as much as 720

So is there any algorithm which makes my work simpler

This requirement can be compared to a mobile phone buying site.
where those sites give u options to choose the features of a phone
like bluetooth IR, radio gprs etc

you choose IR n radio, and all the phone having IR and radio will come irrespective of the presence of gprs and blutooth.
Posted
Updated 28-Sep-10 8:43am
v2

1 solution

Hi

You can use CheckBoxList control, which can have multiple check boxes

Consider control CheckBoxList has id C when you click on button
funtion to get the serach result gets called in that funstion you write the below condition


for(int i=0; i< c.Items.Count;i++)
{
  if(c.Items[i].Selected)
    {
        // get the selected checkbox value using c.Items[i].Text
         
    }
}


Write the SQL Select query to fetch the data by passing the checkbox selected values or use stored procedure to fetch data
 
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