Step 1:- (Site.Master)
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Menu1.aspx" Text="Menu
1" />
<asp:MenuItem NavigateUrl="~/Menu2.aspx" Text="Menu
2" />
<asp:MenuItem NavigateUrl="~/Menu3.aspx" Text="Menu
3" />
<asp:MenuItem NavigateUrl="~/Menu4.aspx" Text="Menu
4" />
</Items>
</asp:Menu>
<div id="dvSummary" runat="server">
<h1>Dot Net
Example</h1>
<h3>We have
many things to learn from others</h3>
</div>
Step
2:- (Content Page)
Hide
Menu
protected void Page_Load(object sender, EventArgs e)
{
if (Master
!= null)
{
Menu menu
= (Menu)Master.FindControl("Menu1");
if (menu
!= null)
{
menu.Visible = false;
}
}
}
Hide/
Disable Single Menu Item
protected void Page_Load(object sender, EventArgs e)
{
if (Master
!= null)
{
Menu menu
= (Menu)Master.FindControl("Menu1");
if (menu
!= null)
{
menu.Items[1].Enabled = false;
}
}
}
Hide Div
protected void Page_Load(object sender, EventArgs e)
{
if (Master
!= null)
{
HtmlGenericControl dv =
(HtmlGenericControl)Master.FindControl("dvSummary");
dv.Visible
= false;
}
}
No comments:
Post a Comment