开发者

Can you use AJAX page methods to make non-static function calls?

开发者 https://www.devze.com 2023-03-19 11:33 出处:网络
Javascript: PageMethods.DragEventToEvent(event.text(), event.parent().paren开发者_如何学JAVAt().text(), cell.parent().text(),OnSucceeded, OnFailed);

Javascript:

PageMethods.DragEventToEvent(event.text(), event.parent().paren开发者_如何学JAVAt().text(), cell.parent().text(),   OnSucceeded, OnFailed);

C# Function:

    [WebMethod]
    public static void DragEventToEvent(string evt, string startCell, string endCell) {
       //Blahblah
    }

This "works", but it's a static call. I need a non-static call here. Can it be done with page methods?


No you cant use non-static function calls with PageMethods.

Use System.Web.UI.ICallbackEventHandler instead.

Implementing Client Callbacks Programmatically Without Postbacks in ASP.NET Web Pages

Example 1:

Asynchronous client script callbacks

Example 2:

Using ICALLBACKEventHandler in ASP.NET

GL HF ;)

0

精彩评论

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