问题
I have developed a web browser in c# using System.Windows.Forms.WebBrowser But it doesn't show "asp:Menu" items at my pages. I've use this code in my asp project:
<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>
also I've used more web browser sources downloaded from codeproject.com like this: http://www.codeproject.com/Articles/60179/Web-Browser-in-C
回答1:
Apparently, your page works in other browsers but not in WebBrowser
control. If so, try implementing WebBrowser Feature Control.
[EDITED] Once you've implemented FEATURE_BROWSER_EMULATION
, if you want the standard rendering mode with the latest HTML5 features for WebBrowser
, the following markup will enable it for your page:
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- cutting edge rendering -->
</head>
</html>
回答2:
I think, the problem is on your browser. I try your code, and it shown correctly.
来源:https://stackoverflow.com/questions/18374596/show-asp-menu-in-c-sharp-webbrowser