读书人

在线急等关于master page的有关问题

发布时间: 2012-01-28 22:06:13 作者: rapoo

在线急等,关于master page的问题
以下是我的代码,
我在项目里的其他页面内调用了这个master page的ContentPlaceHolder2:
<asp:Content ID= "Content3 " ContentPlaceHolderID= "ContentPlaceHolder2 " Runat= "Server ">
</asp:Content>

现欲在master page中的 ContentPlaceHolder1 控件内装载一个固
定的页面A.aspx(A.aspx是一个菜单页)

注:实现这个的目的其实在于将frameset转为master page。


以下是mster page代码:

<table style= "width:100%; height:100% " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td colspan= "2 " style= "height:76px; background-color:Blue; ">
</td>
</tr>
<tr>
<td style= "width:170px; height:501px; text-align: center; ">
<asp:ContentPlaceHolder ID= "ContentPlaceHolder1 " runat= "server " >
</asp:ContentPlaceHolder>
</td>
<td valign= "top " align= "center ">
<asp:ContentPlaceHolder ID= "ContentPlaceHolder2 " runat= "server " >
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td bgcolor= "#9FCFFF " colspan= "2 "> <div align= "center "> <span class= "STYLE1 " style= "font-size: 10pt; font-family: System "> CopyRight©2007 江西宜春经济开发区版权所有 </span> </div> </td>
</tr>
</table>



[解决办法]
UserControl uc = new UserControl();
UserControl uc1= uc.LoadControl( "~/123/34 ") as UserControl;
ContentPlaceHolder cph=this.Page.Master.FindControl( "ContentPlaceHolder ") as ContentPlaceHolder;
cph.Controls.Add(uc1);

读书人网 >asp.net

热点推荐