Disable MasterPage Menu from a contentPage

0

I have a small menu on Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="INTEGRASYS.SiteMaster" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title> ::INTEGRASYS::</title>
    <link href="~/Styles/estilo.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>

<body>
    <form runat="server">
        <header>

                <ul>
                    <li class = "liultimo"><a href = "index.aspx" > ADM SYS </a></li>
                    <li> <a href = "administrativo.aspx" > Administrativo </a></li>
                    <li> <a href = "" > Executivo </a></li>
                    <li> <a href = "" > Comercial </a></li>
                    <li> <a href = "" > Técnico </a></li>
                </ul>
        </header>
. . . 

My home page is login ( login.aspx ). What I want to do is to leave these list items disabled ( li ) and enable them after the login , page index.aspx

login is already working and redirects to index.aspx .

    
asked by anonymous 28.11.2014 / 04:36

1 answer

2

One possible solution is to leave the <li> that will not be displayed within a Panel .

<ul>
    <li class="liultimo"><a href="index.aspx" >ADM SYS</a></li>
    <asp:Panel runat="server" Visible="False" ID="pnlEsconder">
        <li><a href="administrativo.aspx">Administrativo</a></li>
    </asp:Panel>
    <li><a href="">Executivo</a></li>
    <li><a href="">Comercial</a></li>
    <li><a href="">Técnico</a></li>
</ul>

and the code behind , Content Page , check if the User is logged in, and display the panel.

var pnlEsconder = (Panel)Master.FindControl("pnlEsconder");
if (Session["logado"] != null) pnlEsconder.Visible = true;
    
10.12.2014 / 17:20