Search code examples
javascriptasp.netserver-side

call server-side method from javascript in postback


Possible Duplicate:
Call ASP.NET Function From 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:

    <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.


Solution

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