Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<% if((Session["Rol"]).ToString() == "Yönetici")
                         { %>
                                                          <li>

                          <a href="SiparisEkle.aspx">class="fa fa-edit fa-fw">Sipariş Ekle</a>

                      </li>
                       <% } %>


What I have tried:

C#
Hi how can I do this example. I want to if Role == Yonetici show menu if Role == Depocu dont show menu.
Posted
Updated 2-Dec-16 5:43am

1 solution

I would suggest not trying to use inline code like that. That style is old classic ASP style and I'm not even sure it fully works in ASP.Net. First put runat="server" on your a tag and id="hypSip" so you can access it in C# or use an asp:HyperLink instead.

In your Page_Load event in C# codebehind page you can simply do
C#
hypSip.Visible = Session["Rol"].ToString() == "Yönetici"; // you may want to check to make sure it is not NULL first to be safe.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900