tantormedia
asked on
How to make a panel invisible
Dear experts,
I have a Panel in my Master page:
<asp:Panel ID="pnlSettings" runat="server" >
[<asp:LinkButton ID="btnSettings" runat="server" Text="Settings" OnClick="btnSettings_Click " />]
</asp:Panel>
I want it to be invisible for certain users. I tried it in my Page's Page_Init():
if(some conditions)
{
Panel pnlSettings = ((TPSMasterPage)Master).Ge tControl(( TPSMasterP age)Master , "pnlSettings") as Panel;
if (pnlSettings != null)
{
pnlSettings.Visible = false;
}
}
This code is executed, but the Panel is still visible.
I tried to move it to Master page's Page_Load(), with the same result. What am I doing wrong?
Thanks.
I have a Panel in my Master page:
<asp:Panel ID="pnlSettings" runat="server" >
[<asp:LinkButton ID="btnSettings" runat="server" Text="Settings" OnClick="btnSettings_Click
</asp:Panel>
I want it to be invisible for certain users. I tried it in my Page's Page_Init():
if(some conditions)
{
Panel pnlSettings = ((TPSMasterPage)Master).Ge
if (pnlSettings != null)
{
pnlSettings.Visible = false;
}
}
This code is executed, but the Panel is still visible.
I tried to move it to Master page's Page_Load(), with the same result. What am I doing wrong?
Thanks.
ASKER
Thank you for your response.
Would my code work for you? Do you have any idea why it doesn't work for me?
Would my code work for you? Do you have any idea why it doesn't work for me?
>> I tried to move it to Master page's Page_Load()
Have you tried the content page's Page_Load() ?
Have you tried the content page's Page_Load() ?
ASKER
Yes, I tried it now, with no success.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No, doesn't help :(
ASKER
Figured it out. The problem was that I had two panels with the same id. Sorry for the confusion.
As far as "Visible = false," that approach has worked form me.
Open in new window