Replace UpdatePanel with JQuery

前端 未结 3 1548
隐瞒了意图╮
隐瞒了意图╮ 2020-12-24 09:33

I\'m using UpdatePanel to asynchronously call a button click event in a page that calls a method in another class which writes out an XML file on the output. Is there a way

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 09:40

    A simple alternative way to using jQuery to do ajax without the update panel is to use a build in mechanism of ASP.NET called 'page methods'. By decorating a static method in the page behind with [WebMethod] the web site will have a generated javascript function you can call using PageMethods.MethodName(param1, param2). You will still need to include a ScriptManager control and enable page methods like this:

     
    

    For more information you can search for 'Page Methods ASP.NET AJAX'.

    Hope this helps

提交回复
热议问题