简体   繁体   中英

show asp menu in c# webbrowser

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

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>

I think, the problem is on your browser. I try your code, and it shown correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM