I have this is my first page FirstPage.aspx

protected void GridName_SelectedIndexChanged(object sender, GridViewSelectEventArgs e)
        {
                String Url = String.Empty;

                int index = e.NewSelectedIndex;

                String Name = String.Empty


                Name = GridName.DataKeys[index].Values["Name"].ToString()

                Url = "RetrieveAddress.aspx?Name= " + Name.ToString();
                Response.Redirect(Url, false);      
                Context.ApplicationInstance.CompleteRequest();

        }

Now, using the Name parameter from the FirstPage.aspx, How to retrieve the address for the corresponsing name in FirstPage.aspx?

In simple words, I need to retrieve the address for the Name (parameter sent from first page) in my second page RetrieveAddress.aspx.

What should be my full code in second page? Please help

Recommended Answers

All 3 Replies

Make me correct if i am wrong..
what my understanding is,
you want to retrive the address on second page based on the name you selected on first page.
seems. first you will select name from the first page and then click on Next button to direct next page and you are fetching address here. aren't you?

if you are. than you can store name into a session while they are selecting name on first page and you can use session value for fetching address for the name.

Request.QueryString["Name"] will get you the query parameter named "Name".

If you need the name of the page:
string refPage = Request.UrlReferrer.ToString();

Now, using the Name parameter from the FirstPage.aspx, How to retrieve the address for the corresponsing name in FirstPage.aspx?

I think that hookedtocsharp is trying to retrieve the "Name" parameter on RetrieveAddress.asp. If that is the case, you can use Request.QueryString["Name"] to capture it during the page load and assign it to a variable.

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.