我已經把我的模板頁面上的用戶控件,比如Test.aspx的無法找到用戶控件在母版頁
<site:Control1 runat="server" id="Bigbox" AdType="bigbox" AdTile="1" ServeOop="True"/>
而且在控制1的後面的代碼,它試圖尋找另一個用戶控件放在母版頁上。現在
if (this.Page.Master.FindControl("Control2") != null),
,我們在設計網站的方式是,我們有模板頁面調用調用另一個母版頁母版頁,我的意思是這Test.aspx的
,它具有
MasterPageFile="~/Views/CMSTemplates/Shows/Show.master"
和Show.master,它具有
MasterPageFile="~/Views/CMSTemplates/Wrapper.master"
在Wrapper.master
,它具有現在
,是的Site.Master在根級別的母版頁,所有模板提及這一點。
但是當我把控制2上的Site.Master
<site:Control2 runat="server" id="Control2"/>,
如果(this.Page.Master.FindControl(「控制2」)將返回null。我理解,因爲是的Site.Master幾個層次,從測試了的.aspx,所以我試圖把控制2在Show.master Wrapper.master,對照1仍然未能找到控制2。
我甚至試圖把@masterType指令,仍然是行不通的
任何意見或建議?
請指教。
感謝
我正在通過ID查找它們。 – doglin
不,你不是。 「Control2」不是ID。 「DfpAdManager」是ID。 –