Sign in | Join
Last post 08-20-2009 9:06 PM by bec.username. 3 replies.
Sort Posts: Oldest to newest Newest to oldest
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?
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())%>
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
Thanks everyone. I ended up using this
<a href="<%=Request.UrlReferrer.ToString()%>">Go back</a>