Hi friend,
To add the history point in Asynchronous call you can set EnableHistory
propery of ScriptManeger to true.
This event is raised during asynchronous postbacks automatically when the
server-side history state changes.
Refer the following code snippet
<asp:ScriptManager ID="SM1" runat="server"
EnableHistory="true" OnNavigate="SM_Navigating" />
<script runat="server">
private void DoTheAjaxWork(string step)
{
if (SM1.IsInAsyncPostBack && !SM1.IsNavigating)
{
// perform all your real work here and add the history point
SM1.AddHistoryPoint("historyPoint", step, "Step " + step);
}
else
{
txtBox1.Text = step;
this.Title = "Step " + step;
}
}
protected void SM_Navigating(object sender, HistoryEventArgs e)
{
string state = e.State["historyPoint"];
if (!string.IsNullOrEmpty(state))
{
DoTheAjaxWork(e.State["historyPoint"]);
}
}
</script>
Thanks & Regards,
Shrinivas Mada,
On Thu, Jan 20, 2011 at 3:30 AM, f1crazed <[email protected]> wrote:
> Hello,
>
> Here is my scenario:
>
> I am using a web service to pass back search results. To do this I
> am
> using ToolkitScriptManager with a ServiceReference to my web service
> and calling the web service up with javascript. The javascript call
> looks something like this:
>
> WebService.GetResults("search term", OnSuccessGetData, OnFail);
>
> If the request is successful the "OnSuccessGetData" function is fired
> and the results are inserted into a DIV tag. Because the resulting
> search results can be large I wrote the service to only pass back the
> first 20 results on the first trip. After that I make calls again to
> the service to return the next 5 results and continue to do this until
> all the results are loaded. This all works wonderful. You can see it
> in action at www.lsbio.com and use the search term "human mouse". My
> problem is that when the user clicks on a product and then hits the
> 'Back' button the search results have to be fetched again from the
> webservice.
>
> Is there a way to keep the search results in the DIV tag to remain as
> part of the page so when the user navigates away from the search page
> and uses the 'Back' button to navigate back the search results are
> still there without having to hit the webservice again?
>
> If I didn't make myself clear enough on what I am trying to do, go
> ahead and test the site www.lsbio.com, use the search terms human
> mouse, click on a product and then hit the back button.