show asp menu in c# webbrowser

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 04:45:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!