I want to add search functionality to a website. i want to use the following controls:

TextBox   Dropdownlist1     DropDownlist2       SearchButton
(Title)   (Book OR DVD)      (Category/Genre)

I want the items of DropDownList2 change when a specific item is selected in DropDownlist1, and based on that search results are displayed.

And I wish that the search results are displayed even if the user provides an input in only one of the controls.

Also, please help me with the SQL query for the same.

Thanks in advance! :)
6 Years
Discussion Span
Last Post by plusplus

First of all add a SQLDatasource to each dropdown lists control, then configure the data source (i hope u knw how to do that). The query for that of the first sqldatasource is

SelectCommand="SELECT column from Table"

That of the second one will be:

SelectCommand="SELECT Column From Table WHERE column = @col"
<Select Parameters>
<asp:ControlParameter ControlID="DropDownList1" Name="col" />

Make sure you set the AutoPostBack Property of the DropDownList1 to TRUE. And i'll advice you insert an Update panel control on your page to avoid refreshing ur page everytime. Let me know if u encounter any other problem.


I am a novice in programming and i need to finish my project on urgent basis....can you please explain "configure the data source" part and all the other necessary information...i am in a great hurry to get this project done....Thanks once again


Can anybody provide solution for this one??

I configured datasource to dropdownlist1...how can i make the contents of dropdownlist2 change based on the selection in dropdownlist1...so please tell me how to do it?

i think its not possible to have 2 datasources for a single dropdownlist control...


when you configure datasource for second dropdownlist, then for select parameters chose control and dropdownlist1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.