PageMethod - What is needed to use them?

Discussion in 'ASP .Net' started by dnadeveloper, Jul 6, 2007.

  1. dnadeveloper

    dnadeveloper Guest

    Can anyone tell me what is is required to get the PageMethod code into my
    ..aspx pages? (More accurately, into the rendered page.)
    So far I have a scripmanager with EnablePageMethods wet to true.


    TIA
    Chris
     
    dnadeveloper, Jul 6, 2007
    #1
    1. Advertising

  2. Chris,

    I think they must be static and mark with WebMethod attribute

    [System.Web.Services.WebMethod()]
    public static string GetUserName(int id)
    {
    return "Chris";
    }

    Hope this helps
    --
    Milosz


    "dnadeveloper" wrote:

    > Can anyone tell me what is is required to get the PageMethod code into my
    > ..aspx pages? (More accurately, into the rendered page.)
    > So far I have a scripmanager with EnablePageMethods wet to true.
    >
    >
    > TIA
    > Chris
    >
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Jul 6, 2007
    #2
    1. Advertising

  3. I forgot there's another attribute you need to apply,

    [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public static string GetUserName(int id)
    {
    return "Chris";
    }

    Now it should work
    --
    Milosz


    "Milosz Skalecki [MCAD]" wrote:

    > Chris,
    >
    > I think they must be static and mark with WebMethod attribute
    >
    > [System.Web.Services.WebMethod()]
    > public static string GetUserName(int id)
    > {
    > return "Chris";
    > }
    >
    > Hope this helps
    > --
    > Milosz
    >
    >
    > "dnadeveloper" wrote:
    >
    > > Can anyone tell me what is is required to get the PageMethod code into my
    > > ..aspx pages? (More accurately, into the rendered page.)
    > > So far I have a scripmanager with EnablePageMethods wet to true.
    > >
    > >
    > > TIA
    > > Chris
    > >
    > >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Jul 6, 2007
    #3
  4. dnadeveloper

    dnadeveloper Guest

    "Milosz Skalecki [MCAD]" <> wrote in message
    news:...
    >I forgot there's another attribute you need to apply,
    >
    > [System.Web.Services.WebMethod]
    > [System.Web.Script.Services.ScriptMethod]
    > public static string GetUserName(int id)
    > {
    > return "Chris";
    > }
    >
    > Now it should work
    > --
    > Milosz
    >
    >
    > "Milosz Skalecki [MCAD]" wrote:
    >
    >> Chris,


    Thank you. All is good!




    >>
    >> I think they must be static and mark with WebMethod attribute
    >>
    >> [System.Web.Services.WebMethod()]
    >> public static string GetUserName(int id)
    >> {
    >> return "Chris";
    >> }
    >>
    >> Hope this helps
    >> --
    >> Milosz
    >>
    >>
    >> "dnadeveloper" wrote:
    >>
    >> > Can anyone tell me what is is required to get the PageMethod code into
    >> > my
    >> > ..aspx pages? (More accurately, into the rendered page.)
    >> > So far I have a scripmanager with EnablePageMethods wet to true.
    >> >
    >> >
    >> > TIA
    >> > Chris
    >> >
    >> >
     
    dnadeveloper, Jul 6, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonieko

    HttpHandlers - Learn Them. Use Them.

    Anonieko, Jun 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    529
    tdavisjr
    Jun 16, 2006
  2. =?Utf-8?B?Um9nZXIgTWFydGlu?=

    First PageMethod blocks second page method from executing

    =?Utf-8?B?Um9nZXIgTWFydGlu?=, Jul 23, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    634
    =?Utf-8?B?Um9nZXIgTWFydGlu?=
    Jul 23, 2007
  3. =?Utf-8?B?Um9nZXIgTWFydGlu?=

    First AJAX PageMethod blocks second page method from executing

    =?Utf-8?B?Um9nZXIgTWFydGlu?=, Jul 24, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    458
    =?Utf-8?B?Um9nZXIgTWFydGlu?=
    Jul 26, 2007
  4. Rory Becker
    Replies:
    8
    Views:
    704
    Steven Cheng [MSFT]
    Aug 4, 2008
  5. why the lucky stiff
    Replies:
    5
    Views:
    148
    why the lucky stiff
    Sep 22, 2004
Loading...

Share This Page