开发者

PageMethods and page controls reference

开发者 https://www.devze.com 2023-01-07 08:24 出处:网络
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 loa

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消