I have a user control .Is there some way to get the page in which usercontrol is available ?
+1
A:
You want the Page
property.
If you need to write back to a page of a certain type, you'll have to cast:
var myUserPage = Page as MyCustomUserPageClass;
if (myUserPage != null) {
myUserPage.Foo = "bar";
}
Dave Markle
2010-08-31 11:34:20
A:
In your usercontrol write this method
protected void MyMethod()
{
Page myParent = this.Page;
...
}
Pranay Rana
2010-08-31 11:35:00
Best to use MyPage page = this.Parent as MyPage; in case the Page type isn't MyPage.
Ocelot20
2010-08-31 13:07:08