PageMethods and page controls reference
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 开发者_JS百科and load it to the page, and the structure is complex.
Thanks in advance for any help.
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.
精彩评论