1

i need to know how to call non-static server side method from client side by jquery. i search google and came to know that it is not possible. i am aware of how to call server side static method by jquery. here one small snippet

[WebMethod]
public static string yourmethod(/*params*/)
{
  return "Hello World!"   
}

$.ajax({
    type: 'POST',
    data: /*Your Data*/,
    dataType: 'JSON',
    contentType: 'application/json',
    url: '/yourpage.aspx/yourmethod',//Method to call
    success: function(result, status) {
            //handle return data
    },
    error: function(xhr, status, error) {
            //handle error
    }
 });

but there must be some mechanism by which we can call server side non static function by jquery or plain javascript because update panel, Ajax.Net library enable users to call server side function from client side. when we put a button in update panel and when we click that button then corresponding server side function get invoke.........so tell me how it is possible. how update panel call server side function behind the scene. please discuss how update panel is developed and how it can call server side method.

Thomas
  • 33,544
  • 126
  • 357
  • 626
  • This does a good job of explaining it http://encosia.com/why-do-aspnet-ajax-page-methods-have-to-be-static/ - UpdatePanel is a different beast as behind the scenes it *still* does a postback (but just a partial one) – Kevin Main Jun 13 '12 at 09:23
  • if possible kevin please discuss how update panel make the partial postback...i search google but found no relevant article about update panel partial postback. – Thomas Jun 13 '12 at 10:25
  • The site I have linked above is a good source of info in particular this article http://encosia.com/are-you-making-these-3-common-aspnet-ajax-mistakes/ – Kevin Main Jun 13 '12 at 10:33
  • And this answer has some useful info as well http://stackoverflow.com/a/8326714/1191903 – Kevin Main Jun 13 '12 at 10:36

0 Answers0