Hide menu on login screen C #

0

I'm having a problem, I need to hide a menu on the login screen when it loads. I used a solution that works locally, but the server does not happen, it follows:

//MENU QUE FICA NA MASTER PAGE
 <asp:Panel ID="Panel1" runat="server">
                <asp:LoginView runat="server" ViewStateMode="Disabled">
                    <AnonymousTemplate>
                      //CONTEUDO DO MENU
                    </AnonymousTemplate>
                 </asp:LoginView>
 </asp:Panel>

//ISSO ESTÁ NO PAGE_LOAD DA TELA DE LOGIN
Panel ocultaMenu = (Panel)Master.FindControl("Panel1");
ocultaMenu.Visible = false;
    
asked by anonymous 11.05.2017 / 18:42

2 answers

0

You can try to change the property of the element (Design), and as soon as you log in, make changes to the code. Under Property go to Behavior, find Enabled and set false. in the code where you want to load it places Panel1.Enabled = true;

    
11.05.2017 / 18:47
0

I tested your code here and it works normally, but since it is not working on the server it does not cost anything to check other possibilities.

You can create a method in the Master.cs that receives true or false, in this method you display or hide the component.

public partial class MyMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void EsconderExibirPanel(bool exibe)
    {
        Panel1.Visible = exibe;
    }
}

And where you want to hide the component can invoke this method.

((MyMaster)Page.Master).EsconderExibirPanel(false);
    
02.06.2017 / 23:01