ASP.NET PageMethods from javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gagandeepgupta16
    New Member
    • Feb 2007
    • 56

    #1

    ASP.NET PageMethods from javascript

    Hi

    I have situation where i need to call a server side method from javascript without postback, (dont want to use __doPostBack())

    I found this method called PageMethods implemented using ScriptManager and a static method in the page, this static webmethod is called successfully from javascript.

    Now my purpose was to set/get a class property from javascript and the pagemethod has to a static which cannot access the non-static property.

    can anyone please suggest me a wayout for this situation?

    thanks in advance.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by gagandeepgupta1 6
    Hi

    I have situation where i need to call a server side method from javascript without postback, (dont want to use __doPostBack())
    Every time your web page makes a call to the server it does a postback. This is just how things work.

    Originally posted by gagandeepgupta1 6
    I found this method called PageMethods implemented using ScriptManager and a static method in the page, this static webmethod is called successfully from javascript.

    Now my purpose was to set/get a class property from javascript and the pagemethod has to a static which cannot access the non-static property.

    can anyone please suggest me a wayout for this situation?

    thanks in advance.
    It really sounds like you want to use Ajax to call a function on the server that sets a property.

    Look into using an UpdatePanel in your page to perform an asynchronous call to the server.

    -Frinny

    Comment

    Working...