Reputation: 445
I'm using pagemethods to call a method from javascript, is there a way to access the page's controls from the method in codebehind (marked as static)? The problem is that the pagemethod nedds to load a business entity and load it to the page, and the structure is complex.
Thanks in advance for any help.
Upvotes: 0
Views: 988
Reputation: 460058
Even in a static/shared method you can access your page.
C#:
(WebForm1)HttpContext.Current.Handler
VB.Net:
DirectCast(HttpContext.Current.Handler, WebForm1)
Where WebForm1 is your page-type. Then you can access all your controls.
Upvotes: 1