在回发[duplicate]中从javascript调用服务器端方法

时间:2021-08-26 15:53:30

Possible Duplicate:
Call ASP.NET Function From Javascript?

可能的重复:ASP。净函数从Javascript ?

In my custom ajax server-side control I draw image (using html5) and I need to invoke server-side function when user click it (just do it usual button).I want to do it like this:

在我的自定义ajax服务器端控件中,我绘制图像(使用html5),当用户单击它时,我需要调用服务器端函数(只需执行常规按钮)。我想这样做:

    <xx:MyControl ... runat="server" onchange = "server side function"/>

I dont want just invoke do_postback function with ControlId an EventArgument parametrs beckause then I must do additional work to specify the action and invoke appopriate function - I want to keep my code-behind clear and I dont want end user that will use my component do this work.

我不想仅仅调用do_postback函数来控制一个EventArgument参数,然后我必须做额外的工作来指定动作和调用appopriate函数——我想要保持我的代码清晰,我不希望最终用户使用我的组件来完成这项工作。

1 个解决方案

#1


3  

You will need to implement IPostBackDataHandler interface, this and this article will guide you to accomplish this.

您将需要实现IPostBackDataHandler接口,本文将指导您实现这一点。

#1


3  

You will need to implement IPostBackDataHandler interface, this and this article will guide you to accomplish this.

您将需要实现IPostBackDataHandler接口,本文将指导您实现这一点。