asp.net更改主站点布局运行时

时间:2014-01-28 14:14:54

标签: asp.net

我在我的asp.net网站的母版页上有以下代码,并且在运行时它将它放入表格和mt菜单中没有看到任何想法为什么会发生这种情况。

我使用了firebug来检查代码,我能够看到代码在运行时已经改变了

<form runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Panel ID="Panel1" runat="server" CssClass="roundPanel">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/cisi.png" 
                        ImageAlign="AbsMiddle" />&nbsp;&nbsp;Professional Refresher Manager
                </h1>
            </div>
            <div class="loginDisplay">

                <asp:Label ID="lblBreadCrumb" runat="server" Text=""></asp:Label>
                           </div>
            <div class="clear hideSkiplink">
                <asp:Label ID="lblProduct" runat="server" CssClass="productHeading"></asp:Label>
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" 
                    EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" 
                    MaximumDynamicDisplayLevels="5" >
                    <DynamicMenuStyle CssClass="menuindex" />
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="~/Modules.aspx" Text="Modules"  
                            PopOutImageUrl="~/images/ratingStarFilled.gif" Value="Modules">
                            <asp:MenuItem NavigateUrl="~/AddModule.aspx" Text="Add New" 
                                ToolTip="Add New Module" Value="Add New"></asp:MenuItem>
                        </asp:MenuItem>
<asp:MenuItem Text="Page Templates" Value="pages">
                        </asp:MenuItem>
                        <asp:MenuItem Text="Resources" Value="Resources">
                            <asp:MenuItem NavigateUrl="addResource.aspx" Text="Add New" Value="Add New">
                            </asp:MenuItem>
                        </asp:MenuItem>
                      <asp:MenuItem Text="catManager" Value="catManager" NavigateUrl="~/categoryManager.aspx">
                        </asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/reports/reportsDefault.aspx" Text="Reports" 
                            Value="Reports">
                            <asp:MenuItem NavigateUrl="~/reports/reportsDefault.aspx" Text="Views" 
                                Value="Views"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/reports/Candidates.aspx" Text="Candidates" 
                                Value="Candidates"></asp:MenuItem>
                        </asp:MenuItem>
                    </Items>
                </asp:Menu>
                </div>
                        </div>&nbsp;<div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server">

            </asp:ContentPlaceHolder>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">

    </div>
    </asp:Panel>
    <asp:RoundedCornersExtender runat="server" TargetControlID="Panel1"></asp:RoundedCornersExtender>
    </form>

1 个答案:

答案 0 :(得分:1)

Blow你可以从数据库中添加文件的名称,并在下面添加代码到页面加载方法,并在运行时添加css文件

 HtmlLink subcss = new HtmlLink();
        subcss.Href = Name of CSS file to be loaded from database.;
        subcss.Attributes.Add("rel", "stylesheet");
        subcss.Attributes.Add("type", "text/css");
        Page.Header.Controls.Add(subcss);