Back button for smart search results

Nicole Johnson asked on April 13, 2015 18:23

Hi,

I have finally managed to get a custom smart search working with filters etc, but have a slight issue.

So the current way it works is it has a route to a page, then when the filter kicks in it wants to go to an .aspx page so the page has 2 urls to point at so it caters for both scenarios.

When you then click on a result it correctly takes you to the aspx page displaying the single item.

The problem is on this page I want a "Return to results" type button which will go back, but retain whatever filter they had entered, but if I try <a href="javascript:history.go(-1)">Go Back</a> it returns with "Webpage has expired" (I presume as it has no data being passed to it).

Does anyone know what I can do to add a link to return to the aspx results page so that it retains the filters entered?

Thanks in advance of any help

Correct Answer

Brenden Kehren answered on April 13, 2015 19:00

Wrap the smart search webparts in an update panel. Do this either in the webpart itself or the webpart zone. Should be as easy as checking a checkbox.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Nicole Johnson answered on April 14, 2015 12:33

Hi Brenden,

Great news, I have just tried this and it is very close to what I want, just not quite there.

It now correctly stays on the same page which is great, but when you go to a result and then go back it doesn't throw the error, but does not retain the filters entered previously.

Is there a way of keeping the filters as they were?

Thanks

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 14, 2015 13:37

If you're physically navigating to another page (not page in the repeater results but physical site page), you'd have to setup some sort of session/cookie to store those filter values and have the webpart search for them on page load. Unless there is some other function of Kentico or ASP.NET I'm not aware of this would be the way to go.

0 votesVote for this answer Mark as a Correct answer

Nicole Johnson answered on April 15, 2015 10:03

Ok thanks Brenden, I am as you say navigating to a different page so will just have to put up with the filters being reset. Thanks for your help!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.