Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 21, 2009 01:06 AM by bec.username
Member
163 Points
83 Posts
Aug 20, 2009 03:46 AM|LINK
There are 2 views in my mvc app that show a list of items. Both provide the ability to edit them by redirecting to a Edit view. How can I provide a back link on the Edit form that takes the user back to the list they were on?
Contributor
2542 Points
401 Posts
Aug 20, 2009 08:48 AM|LINK
create a hidden field in Edit view and save the UrlReferer in it. On postback use this field value to track the back address.
<%=Html.Hidden("UrlReferer",Request.Form["UrlReferer"]??Request.UrlReferer.ToString())%>
2718 Points
503 Posts
Aug 20, 2009 05:54 PM|LINK
Hi,
You can redirect the page with Appending PageName Querystring parameter url on click of edit button
for Ex:-
http://localhost/MyController/EditView/2/PageName=1stPage
http://localhost/MyController/EditView/2/PageName=2ndPage
Aug 21, 2009 01:06 AM|LINK
Thanks everyone. I ended up using this
<a href="<%=Request.UrlReferrer.ToString()%>">Go back</a>
bec.username
Member
163 Points
83 Posts
How to return to previous view?
Aug 20, 2009 03:46 AM|LINK
There are 2 views in my mvc app that show a list of items. Both provide the ability to edit them by redirecting to a Edit view. How can I provide a back link on the Edit form that takes the user back to the list they were on?
ZafarYousafi
Contributor
2542 Points
401 Posts
Re: How to return to previous view?
Aug 20, 2009 08:48 AM|LINK
create a hidden field in Edit view and save the UrlReferer in it. On postback use this field value to track the back address.
<%=Html.Hidden("UrlReferer",Request.Form["UrlReferer"]??Request.UrlReferer.ToString())%>maverickhyd
Contributor
2718 Points
503 Posts
Re: How to return to previous view?
Aug 20, 2009 05:54 PM|LINK
Hi,
You can redirect the page with Appending PageName Querystring parameter url on click of edit button
for Ex:-
http://localhost/MyController/EditView/2/PageName=1stPage
http://localhost/MyController/EditView/2/PageName=2ndPage
bec.username
Member
163 Points
83 Posts
Re: How to return to previous view?
Aug 21, 2009 01:06 AM|LINK
Thanks everyone. I ended up using this