Hello Forum,
I already have a C# that hides button control when user is not an admin. I also want to make a list item on the navigation bar to be invisible when user who is not an admin logs in.
But when I used this it did not work
HTML:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><asp:Label ID="user" runat="server" Font-Size="smaller" Text="" ForeColor="White"></asp:Label><img alt="" src="images/img1.jpg" height="20" /><b class="caret"></b></a>
<ul class="dropdown-menu" id="dashboard" style="background-color: #00003D;">
<li class="dropdown-header" id="dashB"><a href="DashBoard.aspx" style="color: #FFFFFF; font-size: small; background-color: #00003D;"> Panel</a></li>
</ul>
</li>
C#
public void showdata2()
{
cmd.CommandText = "select * from Users where email= '" + Session["user"] + "'";
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(ds, "detail");
if (ds.Tables[0].Rows.Count > 0)
{
string UserRole;
UserRole = ds.Tables[0].Rows[0][4].ToString().Trim().ToUpper();
if (UserRole == "U")
{
lipaybutton.Visible = false;
dashboard.Visible = false;
}
else if (UserRole == "A")
{
lipaybutton.Visible = true;
dashboard.Visible = true;
}
}
}