0

I want to know, what's the best way to create a custom back button with parameters?

My example:

I have 4 pages that depend on each other and in these pages I have some actions like updating, deleting, creating and after these actions I need to go back on the last page I was before I am

So I have an ID, which I set on the first page and I have this same ID as the parameter for each page.

If I use the back button of the browser, I will have 2 problems .. 1- If I use it after an action, the browser will redirect to the same page as I am and the second time I click this button it will redirect me to the last page .. 2- will redirect me but no parameters.

And I have an obstacle, I have to clear the URL, so after all '?' I have to clean it, so I use this function:

function cleanUrl() { 
   urlpg = $(location).attr('href'); 
   urllimpa = urlpg.split("?")[0] 
   window.history.replaceState(null, null, urllimpa); 
   setInterval("window.status = ''", 1);
}

Currently, I have this: @Html.ActionLink("","","",new { my parameters }) And this parameters I have an object like:

 ObjPreviousPage
 {
     ID
     Filter
     Search
 }

So, on all of my pages i have this:

@Html.ActionLink("","","", new { ID = x, Filter = "y", Search = "z" })

So I want to know, if have a way to better this or if this way isnt recommended

LeoHenrique
  • 229
  • 5
  • 16

1 Answers1

0

instead trying to find a hack to do this. I suggest you to rethink your concept how and when is someone redirected to a new URL. So this could be also helpful to understand the basics

Kinimod
  • 166
  • 1
  • 15