Showing posts with label webmethod. Show all posts
Showing posts with label webmethod. Show all posts

Wednesday, March 28, 2012

Accessing the pages server controls during webmethod calback

Hi,

Tell me please, when we call a webmethod during a callback, we send parameters through the javascript and dom to the webmethod on the server, right?

What if on the server I want, not only to access parameters sent from the javascript calling function, but I also want to acccess controls of the page, like other controls that didnt request the callback, like a gridview control or asp:textbox control, controls that re located on the page but that have nothing to do with the callback call.

Thanks a lot for your help.

PageMethods are static methods and have no access to controls on the page. However the client-side callback can access the DOM.

Monday, March 26, 2012

Access Session in WebMethod

I am trying to access the Session from an ATLAS WebMethod. My session is always equal to null. I am calling the method from javascript. How do I access the session?

[WebMethod]

publicbool DoStuff()

{

if (Session["Data"] !=null)

{

}

Thanks

You need to use [WebMethod(true)] to enable the session from that web method.