Reputation: 67
I have a user control which is in common in two asp.net pages how to find out the parent page i dont want to use the page's title is there any concrete way to determine may be a page's class or any way else
I would like to do this
if (this.page == "pagename")
{
//do this
}
else
{
//do this
}
Upvotes: 1
Views: 625
Reputation: 3307
Try this:
if (this.Page.GetType().Name.ToLower() == "pagename".Replace(".", "_").ToLower())
{
//do this
}
else
{
//do this
}
Upvotes: 0
Reputation: 22619
You can use this.Page
in order to find the current page and use this.Page.GetType()
if you are expecting class name
Upvotes: 2