0

我的 asp.net Web 应用程序的本地版本在 html div 标签中显示菜单控件数据,而实时版本在 html 表格中显示它,谁能告诉我为什么会这样?

 <asp:Menu ID="DynamicMenu" runat="server" DataSourceID="SiteMapDataSourceCustRole"
                    BackColor="#FFFBD6" DynamicHorizontalOffset="2" BorderStyle="None" Height="21px"
                    Font-Names="Verdana" Font-Size="0.9em" ForeColor="#990000" Orientation="Horizontal"
                    StaticSubMenuIndent="10px" MaximumDynamicDisplayLevels="4" DynamicMenuItemStyle-Font-Names="Verdana"
                    DynamicMenuItemStyle-Font-Size="0.8em" OnLoad="DynamicMenu_Load" OnMenuItemClick="OnClick"
                    CssSelectorClass="CssAdapterMenu">
                    <StaticSelectedStyle BackColor="#FFCC66" />
                    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <DynamicHoverStyle BackColor="#990000" ForeColor="White" />
                    <DynamicMenuStyle BackColor="#FFFBD6" />
                    <DynamicSelectedStyle BackColor="#FFCC66" />
                    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <StaticHoverStyle BackColor="#990000" ForeColor="White" />
                </asp:Menu>

本地版本的 HTML 渲染代码

<div id="ctl00_Admin_Menu_DynamicMenu" class="CssAdapterMenu">
            <div class="AspNet-Menu-Horizontal">
                    <ul class="AspNet-Menu">
                        <li class="AspNet-Menu-WithChildren">
                            <span class="AspNet-Menu-NonLink">
                                Administrator</span>
                            <ul>
                                <li class="AspNet-Menu-Leaf">
                                    <a title="Create Roles For the User" class="AspNet-Menu-Link" href="BackOffice/AdminRights/CreateRoles.aspx">
                                        Create Roles</a>
                                </li>
                                <li class="AspNet-Menu-Leaf">
                                    <a title="Create Access Rules For the User" class="AspNet-Menu-Link" href="BackOffice/AdminRights/CreateAccessRules.aspx">
                                        Create Access Rules</a>
                                </li>
                                <li class="AspNet-Menu-Leaf">
                                    <a title="User Status For the User" class="AspNet-Menu-Link" href="BackOffice/AdminRights/User.aspx">
                                        User Status</a>
                                </li>
                                <li class="AspNet-Menu-WithChildren">
                                    <span class="AspNet-Menu-NonLink">
                                        Configuration</span>
                                    <ul>
                                        <li class="AspNet-Menu-Leaf">
                                            <a title="Time Zone Offset" class="AspNet-Menu-Link" href="BackOffice/Configuration/TimeOffSetMaster.aspx">
                                                Time Zone Offset</a>
                                        </li>
                                        <li class="AspNet-Menu-Leaf">
                                            <a title="Common Setting" class="AspNet-Menu-Link" href="BackOffice/Configuration/CommonSetting.aspx">
                                                Common Setting</a>
                                        </li>
                                        <li class="AspNet-Menu-Leaf">
                                            <a title="Company Setting" class="AspNet-Menu-Link" href="BackOffice/Configuration/CompanySetting.aspx">
                                                Company Setting</a>
                                        </li>
                                        <li class="AspNet-Menu-Leaf">
                                            <a title="TemplateSetting" class="AspNet-Menu-Link" href="BackOffice/Configuration/TemplateSetting.aspx">
                                                TemplateSetting</a>
                                        </li>

实时版本上呈现的 HTML

<a href="#ctl00_Admin_Menu_DynamicMenu_SkipLink"><img width="0" height="0" style="border-width:0px;" src="/WebResource.axd?d=vcFBVdJkqWhUa_v0q6LDOxeV_dT8mcvk0VCkxtt-xn5qxLv-jqeFGtbO4qnM2Lc7uM4mwtankfNUJmE_t5h9PUvBOQ81&amp;t=634605430860686371" alt="Skip Navigation Links"></a><table cellspacing="0" cellpadding="0" border="0" cssselectorclass="CssAdapterMenu" class="ctl00_Admin_Menu_DynamicMenu_2" id="ctl00_Admin_Menu_DynamicMenu">
            <tbody><tr>
                <td id="ctl00_Admin_Menu_DynamicMenun0" title="Displays the Admin Menu." onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Administrator</a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Administrator" src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td><td id="ctl00_Admin_Menu_DynamicMenun1" title="Displays the Customer Master." onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Masters            </a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Masters            " src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td><td id="ctl00_Admin_Menu_DynamicMenun2" title="Common Masters      " onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Common Masters      </a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Common Masters      " src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td><td id="ctl00_Admin_Menu_DynamicMenun3" title="Displays the Operations" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Operation/Report</a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Operation/Report" src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td><td id="ctl00_Admin_Menu_DynamicMenun4" title="Manage" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Manage</a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Manage" src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td><td id="ctl00_Admin_Menu_DynamicMenun5" title="Booking" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverStatic(this)"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_4">
                    <tbody><tr>
                        <td style="white-space:nowrap;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_3">Bookings</a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Bookings" src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                    </tr>
                </tbody></table></td>
            </tr>
        </tbody></table><div class="ctl00_Admin_Menu_DynamicMenu_0 ctl00_Admin_Menu_DynamicMenu_7" id="ctl00_Admin_Menu_DynamicMenun0Items" style="visibility: hidden; display: none; top: 23px; height: 67px; clip: rect(auto, auto, auto, auto); left: 5px; z-index: 1;">
            <table cellspacing="0" cellpadding="0" border="0" style="top: 0px;">
                <tbody><tr id="ctl00_Admin_Menu_DynamicMenun6" title="Create Roles For the User" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverDynamic(this)">
                    <td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_6">
                        <tbody><tr>
                            <td style="white-space:nowrap;width:100%;"><a href="BackOffice/AdminRights/CreateRoles.aspx" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_5">Create Roles</a></td>
                        </tr>
                    </tbody></table></td>
                </tr><tr id="ctl00_Admin_Menu_DynamicMenun7" title="Create Access Rules For the User" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverDynamic(this)">
                    <td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_6">
                        <tbody><tr>
                            <td style="white-space:nowrap;width:100%;"><a href="BackOffice/AdminRights/CreateAccessRules.aspx" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_5">Create Access Rules</a></td>
                        </tr>
                    </tbody></table></td>
                </tr><tr id="ctl00_Admin_Menu_DynamicMenun8" title="User Status For the User" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverDynamic(this)">
                    <td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_6">
                        <tbody><tr>
                            <td style="white-space:nowrap;width:100%;"><a href="BackOffice/AdminRights/User.aspx" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_5">User Status</a></td>
                        </tr>
                    </tbody></table></td>
                </tr><tr id="ctl00_Admin_Menu_DynamicMenun9" title="Configuration" onkeyup="Menu_Key(event)" onmouseout="Menu_Unhover(this)" onmouseover="Menu_HoverDynamic(this)">
                    <td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="ctl00_Admin_Menu_DynamicMenu_6">
                        <tbody><tr>
                            <td style="white-space:nowrap;width:100%;"><a style="cursor:text;" href="#" class="ctl00_Admin_Menu_DynamicMenu_1 ctl00_Admin_Menu_DynamicMenu_5">Configuration</a></td><td style="width:0;"><img style="border-style:none;vertical-align:middle;" alt="Expand Configuration" src="/WebResource.axd?d=gxvOxBWRzLCOGR_VNyxocwPpKqUutMKXuoE6SRjTO2mMBeQqpA5qvAWnQz3OMKLNFaUkBMCZE1qYBMBcgjY5fHgyVO01&amp;t=634605430860686371"></td>
                        </tr>
                    </tbody></table></td>
                </tr>
4

2 回答 2

0

确保您的网站在服务器上的 IIS 应用程序池使用与您的开发机器相同版本的 .NET Framework。

于 2013-09-07T12:23:21.000 回答
0

您的本地副本正在运行 asp.net 4,您的主机正在运行 3.5。

RenderingMode您可以通过设置属性来强制呈现模式。更多细节在这里:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.renderingmode.aspx

于 2013-09-07T12:23:31.697 回答