Last post Mar 15, 2015 10:01 PM by Krunal Parekh
Mar 13, 2015 06:36 AM|arunsilivery|LINK
In my project i need to develop advanced search,
Webpage consist of 4 text boxes and 4 (dropdownlist) user can use any controls so that user will get result
give me some code .
Mar 13, 2015 10:34 AM|bobj181|LINK
You can do something simple like this in the where clause of the select statement.
WHERE (Column1 = @Value1 OR @Value1 = '') --TextBox Value
AND (Column2 = @Value2 OR @Value2 = 'defaultValue') --Dropdown value
and so on.
What you need in the where clause is an escape clause. The parenthesis are treated as individual statements and from each statement you want a true to come out of the statement to allow the record to be added to the query. So, even if the text box or drop
down is not selected we still get a true statement out of the if the control is unused.
Mar 15, 2015 10:01 PM|Krunal Parekh|LINK
There are lots of ways to do this.
You can look at this detailed article which defines lots of ways you can do advance search.
Advance search are often very dynamic and changing repeatedly. For your Requirement I suggest you check
Using the CLR section of the article.
To summarize you just need to Build the SQL on code behind and then execute the SQL to get the data.
Hope this helps.