Previous Page
-
Ok, here's my problem. I have two pages: one called FirstPage.aspx and the other one called SecondPage.aspx. Here's what I want to do... I start with FirstPage.aspx and here I have a button and when I click it SecondPage.aspx appears. I do that using Response.Redirect("SecondPage.aspx", false). Ok, now when it loads the second page I want to show in a label the name of the first page. How can I do that? If I have used the PostBackUrl property of the button from the first page, this would have been easy. I would have written in the SecondPage:
protected void Page_Load(object sender, EventArgs e) { if (PreviousPage != null) { Label1.Text = PreviousPage.Title; } }
But, I need to show the second page using Response.Redirect("SecondPage.aspx", false). So any help? -
Ok, here's my problem. I have two pages: one called FirstPage.aspx and the other one called SecondPage.aspx. Here's what I want to do... I start with FirstPage.aspx and here I have a button and when I click it SecondPage.aspx appears. I do that using Response.Redirect("SecondPage.aspx", false). Ok, now when it loads the second page I want to show in a label the name of the first page. How can I do that? If I have used the PostBackUrl property of the button from the first page, this would have been easy. I would have written in the SecondPage:
protected void Page_Load(object sender, EventArgs e) { if (PreviousPage != null) { Label1.Text = PreviousPage.Title; } }
But, I need to show the second page using Response.Redirect("SecondPage.aspx", false). So any help?Just pass the value using Querystring... Do like this when you navigate to the second page: Response.Redirect("secondpage.aspx?name=" + pagename); After you redirect, you will find the value of name easily. In Page_load : protected void Page_Load(object sender, EventArgs e) { string firstpagename = Request.QueryString["name"]; Label1.Text = firstpagename; } I think this is what you needed. Cheers. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript