Hi friends,
I am designing a search page in which the user will select different options and search the results. In the search results page, I will place a button "Ammend Search" / "New Search". By clicking on that will redirect to search page. The search page must persist the prev search criteria. How can I do this?
If I use history.back(), it will work for times when there is no further postbacks to the results page. If there are some postbacks to the results page, its not working.
How can I do this?
Thanks in advance
There are couple of approaches.
1. Make your link a server sided hyperlink, upon the first time entering the page, set its url with the search parameters.
Something like
void Page_Load(...)
{
if(!Page.IsPostBack){
MyLink.NavigationUrl = "search.aspx?name="+Request["name"];
}
}
the link such will maintain the url in viewstate upon postback. Second step is of course, in your search page, if the parameters is in the url, you have to set them back on your search page.
2. Use Profile Service of ASP.NET 2.0. Before search is performed and go the result page, use Profile Object to remember what was entered and such upon coming back, everything will be there.
Just some thoughts.
another approach could be, that you can save the last search criteria in Session Object and can use it later when needed.
0 comments:
Post a Comment