Click here to Skip to main content
14,211,427 members
Rate this:
Please Sign up or sign in to vote.
See more:
<% if((Session["Rol"]).ToString() == "Yönetici")
                         { %>
                                                          <li>

                          <a href="SiparisEkle.aspx">Sipariş Ekle</a>

                      </li>
                       <% } %>


What I have tried:

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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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
hypSip.Visible = Session["Rol"].ToString() == "Yönetici"; // you may want to check to make sure it is not NULL first to be safe.
   

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



Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.1 | Last Updated 2 Dec 2016
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100