在c#webbrowser中显示asp菜单

本文关键字:asp 菜单 显示 c#webbrowser | 更新日期: 2023-09-27 18:28:39

我使用System.Windows.Forms.WebBrowser在c#中开发了一个web浏览器但它不会在我的页面上显示"asp:Menu"项目。我在我的asp项目中使用了以下代码:

 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                <Items>
                    <asp:MenuItem NavigateUrl="~/Default.aspx" Text="default"/>
                    <asp:MenuItem NavigateUrl="~/Exit.aspx" Text="exit"/>
                   <asp:MenuItem NavigateUrl="~/Setting.aspx" Text="setting"/>
                </Items>
            </asp:Menu>

我还使用了更多从codeproject.com下载的网络浏览器源代码,如下所示:http://www.codeproject.com/Articles/60179/Web-Browser-in-C

在c#webbrowser中显示asp菜单

显然,您的页面可以在其他浏览器中工作,但不能在WebBrowser控件中工作。如果是,请尝试实现WebBrowser功能控件。

[EDITED]一旦您实现了FEATURE_BROWSER_EMULATION,如果您想要WebBrowser具有最新HTML5功能的标准渲染模式,以下标记将为您的页面启用它:

<!doctype html> 
<html>
<head> 
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
<!-- cutting edge rendering --> 
</head>
</html>

我认为问题出在你的浏览器上。我尝试了你的代码,结果显示正确。