开发者

How to know which page has called the Usercontrol

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜