How to prevent page being postbacked when i transfer item from one listbox to other

孤人 提交于 2019-12-02 04:16:50

If your version of Visual Studio is less than 2008, then first download the ajax from the following site and install it:

http://ajaxcontroltoolkit.codeplex.com/

Add a reference to the System.Web.Extensions dll and then add the following line right after your opening <form> tag:

<asp:ScriptManager runat="server" ID="Script1"></asp:ScriptManager>

Replace the Your Code in following piece of code with your entire code that you have written above:

<asp:UpdatePanel runat="Server" ID="u1">
<ContentTemplate>
Your Code
</ContentTemplate>
</asp:UpdatePanel>

That's it, this will stop posting back your page.

Take the time to look into using jQuery along with Microsoft's Ajax with Update Panels or moving into jQuery exclusively where possible. Here are two links that are excellent reads regarding the subject:

Microsoft Ajax? http://encosia.com/why-aspnet-ajax-updatepanels-are-dangerous/

jQuery Ajax: http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!