开发者

How to know which page has called the Usercontrol

开发者 https://www.devze.com 2023-02-07 01:15 出处:网络
I have a usercontrol(.ascx) page that is us开发者_JAVA技巧ed by about 10 pages to display something in common. In the control i should know which aspx page is using(or calling). How is that possible?

I have a usercontrol(.ascx) page that is us开发者_JAVA技巧ed by about 10 pages to display something in common. In the control i should know which aspx page is using(or calling). How is that possible?

Thank you in advance!


You can get the page object by calling:

this.Page

Or the URL by calling

HttpContext.Current.Request.Url


You can check Request.Url or (Page)HttpContext.Current.Handler.


The control has a Page property that will be set to the page that it is on.

0

精彩评论

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