Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a search button in my website with a textbox.. i want to make a search for the products in my website.. when i write a product name in a text box and click on the btn go.. it just redirect me to the other page.. which have all the similer products in which is in my search critaria.. can it b done by query string???... pls help

Your code doesn't work because you've not written the code to work, from the sound of it. Yes, the logical thing to do, is to pass the search string via the query string, so that a search can be bookmarked. Then you need to search your DB and return only the values that match, obviously.
Share this answer
this is not a problem, just logical & business, for search button can be done like below:
Response.Redirect("your_search_page.aspx?ID=" + txtSearch.Text);

so in "your_search_page.aspx", you can write a Page_Load event like:
string query = "select * from Products where ProductID = '" + Request.QueryString["ID"] + "'";
// use SqlDataAdapter to fill data to DataTable and binding to GridView 

notes: i don't recommend you create an query by concat strings, the better way is use query string with parameter or store producer
Share this answer
There is a nice article on codeproject: Internal Site Search Engine[^]
Share this answer
RaviRanjanKr 9-Aug-11 3:23am    
Nice Link, My 5+
Praveen Kullu 9-Aug-11 3:35am    
Thank you Ravi

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