开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜