ok so I want to know how the response.redirect works
in one page i do a search for items
page1

protected void _btnSearch_Click(object sender, EventArgs e)
        {  
           Response.Redirect(Pages.TradeUp.Default + "?SearchItem=" + Server.UrlEncode(_txtSearch.Text));
        }

on my "default" page I want to display my results how do I receive my search request to show on the page
here is page 2:

else
                {
                    //Get Items by name search
// should i have something like this?
.ReceiveValue.Text = Request.QueryString(“SearchItem”).ToString
             IList<Item> Items = DaoFactory.FindAll<Item>(Where.Item.Name.Like("%" + SearchItem + "%") || Where.Item.Description.Like("%" + SearchItem + "%"));                                      
                    _gdvItems.DataSource = Items;
                    _gdvItems.DataBind();

                }

I appreciate if someone can help me.

Where is a problem?

Something like that.

But you should all these things in Page_Load method of the web page.

you can extract the value of a query string and store in the local string variable lke this:

string searchvalue = Request.QueryString("SearchItem");

//and then use thevalue of the variable  as shown below

//Get Items by name search
             IList<Item> Items = DaoFactory.FindAll<Item>(Where.Item.Name.Like("%" + searchvalue + "%") || Where.Item.Description.Like("%" + searchvalue + "%"));                                      
                    _gdvItems.DataSource = Items;
                    _gdvItems.DataBind();

or you can directly pass Request.QuertyString("SearhItem") to Like method of above code.

i eother get the page with no data in it, or error message
Non-invocable member 'System.Web.HttpRequest.QueryString' cannot be used like a method.

It's a collection.

string searchvalue = Request["SearchItem"];
IList<Item> Items = DaoFactory.FindAll<Item>(Where.Item.Name.Like("%" + searchvalue + "%") || Where.Item.Description.Like("%" + searchvalue + "%"));                                      
_gdvItems.DataSource = Items;
_gdvItems.DataBind();

OR

string searchvalue = Request.QueryString["SearchItem"];
IList<Item> Items = DaoFactory.FindAll<Item>(Where.Item.Name.Like("%" + searchvalue + "%") || Where.Item.Description.Like("%" + searchvalue + "%"));                                      
_gdvItems.DataSource = Items;
_gdvItems.DataBind();

Use the first method i have suggested. I think it should work.

Hey Thanks I knew that wopuld work I ahd to make soem changes to my code and when I do a serch I get my items but cant not seatch them by description
this is my code

            else
            {                        
                    string searchvalue = Request.QueryString["SearchItem"];
                    IList<TradeListing> items = DaoFactory.FindAll<TradeListing>(Where.TradeListing.Item.Name.Like("%" + SearchItem + "%"));

                _gdvItems.DataSource = items;
                _gdvItems.DataBind();

I had to take oout the Description.like because it was telling I cant use || in a query or soemthing like that, any tips on how I can do the search by description work?
thanks and I appreciate your help.

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.