当前位置:编程学习 > C#/ASP.NET >>

========System.Web.UI.UserControl==如何用==System.Web.UI.Page的基类呢=======

各位大哥

我做了一个
b.aspx(b:PageBase)   继承了PageBase(PageBase:System.Web.UI.Page)这个类



又做了一个b.ascx 这个b.ascx如何才能用到PageBase的内容呢?

--------------------编程问答-------------------- PageBase page = this.Page as PageBase
if( page != null ) --------------------编程问答-------------------- 在b.ascx中:

PageBase page = this.Page as PageBase;
if (page != null)
{
    // do something with PageBase
} --------------------编程问答-------------------- //获得父页面
        Page p = this.Parent.Page;
       Type pageType = p.GetType();
        MethodInfo mi = pageType.GetMethod("A");
用户控件与用户控件之间调用:
        Page p = this.Parent.Page;
        b uc = p.FindControl("b") as b;
       Type pageType = uc.GetType();
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,