首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-01-28 
在线急等,关于master page的问题以下是我的代码,我在项目里的其他页面内调用了这个masterpage的ContentPla

在线急等,关于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&copy;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);

热点排行