S
Steven Cheng[MSFT]
Hi,
Based on my understanding , you have defined a BasePage class(MyPage) and
most other web pages in your asp.net web app will derived from it. Also,
you have a UserControl which is used in some pages. And now you're
wondering how to referece the container Page in the UserControl and access
the page's Parent class's certain members, yes?
As for this problem, I think you can just make use of the UserControl's
"Page" member, this is the instance reference of the Page which contains
the UserControl, you can create the BasePage's variable and convert the
UserControl's Page member to the "BasePage" class and access its certain
members, for example, in the UserControl's Page_Load event, we can use the
following code:
private void Page_Load(object sender, System.EventArgs e)
{
BasePage bp = (BasePage)this.Page;
//set the base page's members
bg.XXX = XXX;
}
Does this answer your questions?
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Based on my understanding , you have defined a BasePage class(MyPage) and
most other web pages in your asp.net web app will derived from it. Also,
you have a UserControl which is used in some pages. And now you're
wondering how to referece the container Page in the UserControl and access
the page's Parent class's certain members, yes?
As for this problem, I think you can just make use of the UserControl's
"Page" member, this is the instance reference of the Page which contains
the UserControl, you can create the BasePage's variable and convert the
UserControl's Page member to the "BasePage" class and access its certain
members, for example, in the UserControl's Page_Load event, we can use the
following code:
private void Page_Load(object sender, System.EventArgs e)
{
BasePage bp = (BasePage)this.Page;
//set the base page's members
bg.XXX = XXX;
}
Does this answer your questions?
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx