tejjas_dave
asked on
Back button to go back to previous page
I have two pages in my web app. The first page has a grid view of a list of items, beside each row entry, I have a 'View' button. On clicking the 'View' button it navigates to the second page which contains a tabbed view of detailed information/view of the corresponding row entry we clicked on the first page.
Now, what I need is a BACK button on the second webpage which on clicking will take me to the first page. Presently I have a simple back button created in the second web page, but it takes me through each view, whatever I had done in my present page, before it navigates me back to the first page. Im trying to create a back button which will skip any operations or tabbed views i have gone through in the present page (Second page) and will take me to the last instance of the first page.
In the first page I have a gridview that is being populated based on a series of list boxes I also have on the first page itself. On hitting "back" on the second page, I want to go to the last instance/view of the first page, so that way it maintains the state of the listboxes and the gridview. In other words, if i hit back I want the listbox to still have the last item that was selected in it to remain selected and the sorting on the gridview to remain the way it is and so on in the first page.
Any ideas or suggestions?
Now, what I need is a BACK button on the second webpage which on clicking will take me to the first page. Presently I have a simple back button created in the second web page, but it takes me through each view, whatever I had done in my present page, before it navigates me back to the first page. Im trying to create a back button which will skip any operations or tabbed views i have gone through in the present page (Second page) and will take me to the last instance of the first page.
In the first page I have a gridview that is being populated based on a series of list boxes I also have on the first page itself. On hitting "back" on the second page, I want to go to the last instance/view of the first page, so that way it maintains the state of the listboxes and the gridview. In other words, if i hit back I want the listbox to still have the last item that was selected in it to remain selected and the sorting on the gridview to remain the way it is and so on in the first page.
Any ideas or suggestions?
ASKER
Hi sm394
Looks like tit should work, Im getting an error saying that System.web.httpRequest.Par ams cannot be used like a method on the line
Response.Redirect(GetBackU RL(Request .Params("B ackURL"))) ;
Any suggestions?
Looks like tit should work, Im getting an error saying that System.web.httpRequest.Par
Response.Redirect(GetBackU
Any suggestions?
yea sorry for syntax mistake
use instead
Request.Params["BackURL"];
use instead
Request.Params["BackURL"];
ASKER
Hi sm394
I tried working with the code that you had mentioned... But it doesn't seem to be taking me back to the last instance of that page. It instead reloads the first page again and when it reloads the first page, it takes the default values as to when it loaded first.
That was a great suggestion though. I was thinking it would work since request.params store all the variables involved... but somehow, it doesent quite work the way i want it. Now, it works similar to just providing a link to the first page. So Im able to go to the page, but just not able to view that last instance that I want to view.
I tried working with the code that you had mentioned... But it doesn't seem to be taking me back to the last instance of that page. It instead reloads the first page again and when it reloads the first page, it takes the default values as to when it loaded first.
That was a great suggestion though. I was thinking it would work since request.params store all the variables involved... but somehow, it doesent quite work the way i want it. Now, it works similar to just providing a link to the first page. So Im able to go to the page, but just not able to view that last instance that I want to view.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
--------------------------
Response.Redirect("abc.asp
//------------------------
private void btnBack_Click(object sender, System.EventArgs e) {
Response.Redirect(GetBackU
}
--------------------------
public static string GetBackURL(string url) {
string res = url;
if ((res.IndexOf("BackURL=") > -1)) {
string backURL = HttpUtility.UrlDecode(res.
res = res.Replace(("BackURL=" + backURL), ("BackURL=" + HttpUtility.UrlEncode(back
}
return res;
}
==========================
to maintain or pre load values you need to store them in session
hope that helps