Hi
could someone help me or guide on how to do this,
I have a home page with a search button(kinda like ebay)
if there is not search criteria entered it will just redirect to default page.
if the user types nokia phone for example i need to genereate a gridview with all the results that match that..I can call a method to do that but it has to be displayed in another page..

protected void _btnSearch_Click(object sender, EventArgs e);
    {
        _txtSearch.text =_txtSearch.text.trim;
        if (_txtSearch.text.lenght <=0){
    }
           else {
      
                Response.Redirect(Pages.TradeUp.Default);

                }

does this look right or what am i missing?

Recommended Answers

All 6 Replies

You need to pass the search criteria ... It may look something like this (I didn't try to compile it):

protected void _btnSearch_Click(object sender, EventArgs e)
{
  if (!string.IsNullOrEmpty(_txtSearch.Text.Trim()))
  {
    Response.Redirect(Pages.TradeUp.Default + "?searchQuery=" + HttpUtility.UrlEncode(_txtSearch.Text));
  }
}

thanks, could explain what + "?searchQuery=" + HttpUtility.UrlEncode(_txtSearch.Text)); does?

my tradeup.default page has a gridview where the rsults shuld be displayed.

It passes the search string to the page so you know what you're supposed to be searching on. Google does it so it must be OK :)!
http://www.google.com/search?hl=en&q=search+terms&aq=f&oq=&aqi=g10

but this would only redirect me to the other page...how do you disply a dataset in c# is like vb so that itshows me the result in a table on the new page.

It redirects you to the other page with your search terms. When you are on the new page you take those search terms and search the database, files, or what ever you are searching and populate the grid with that. You haven't mentioned the structure of your grid or what you are searching. I only know that you provided an example of phone numbers but I don't know where to search for those phone numbers.

sorry my grid is on the other default page, its just a simple search that will look for items kinda like ebay or kijiji and then return a table with items name , id, price, etc. I have aquery that does the search, so do I just call the query on the oher page were my result are displayed ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.