Click here to Skip to main content
14,641,306 members
Rate this:
Please Sign up or sign in to vote.
See more:
Below is the Code in Masterpage

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx"   Text="About"/>
                        <asp:MenuItem NavigateUrl="~/Enquiry.aspx" Text="Enquiry Form"/>

i just want to hide the NavigationMenu in Login page only, becoz we won't required it in Login Page and the rest of pages we must see the Navigation Menu.

what i did is in masterpage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
            string url = HttpContext.Current.Request.Url.AbsoluteUri;
            if (url == "http://localhost/Wilshire_My_Office/Loginpage.aspx")
                NavigationMenu.Style.Add("display", "none");


but it is not working.. could anyone tell me

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi try this,

NavigationMenu.Attributes["style"] = "display:none";


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100