开发者

Replacement for ScriptManager when aiming for Ajax History functionality

When you are creating a Search for your Website, you Want the user experience to be as good as anytime and when you are browsing your gridview you want to be able to pres开发者_运维知识库s the Back Button to go back to the previous viewed page.

In asp.net with asp.net ajax it's possible when using the ScriptManager + Ajax Control Toolkit where there is a History Manager.

Now, when you are using ASP.NET MVC, you Don't have the possibility to use the ScriptManager because it needs to be nested in a server-runned form.

This sample code is used for a Basic search

<% using(Ajax.BeginForm("TestSearch", 
       new AjaxOptions { UpdateTargetId = "details" })) { %>


    <%= Html.TextBox("search") %>

    <input type="submit" value="search" />

<% } %>

When you press the Submit-button on a standard page, you will be posted to a different page, however, in this case, you Wont. So there is no History saved because the whole Web Page was not reloaded.

That's just the first problem.

Problem #2

Since the history is not saved, as proven above, the Search history of a textbox is not updated. A textbox history entry is only added when the page is fully postbacked, how do you solve that with asp.net mvc + ajax?


You can still use HistoryManager, but jquery has some more options.

Which Javascript history back implementation is the best?


Did you check out the MVC ScriptManager?

I know of it, but I know nothing about it ...


The in-built history is available within the MS AJAX scripts in the project; you should be able to make use of it on the client side only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜