Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check for condition in site.master page

I have a site.master page in an asp application which contains a div menu and it looks like this.

<div id="menu">
    <ul>
        <li class="first"><a href="sample.aspx">home</a></li>
        <li><a href="managerserviceshome.aspx">manager services</a></li>
        <li><a href ="employeeservicehome.aspx">employee services</a></li>
        <li><a href="myprojectshomepage.aspx">my projects</a></li>
    </ul>
</div>

What i want is that the manager services portion should be visible only if a particular employee has his 'Is_Manager' field set to True in the database. For the rest this tag should be invisible. How do I achieve this?? How do i check for this contidion over here in this site.master page? please help.

like image 267
scooby Avatar asked Oct 18 '25 07:10

scooby


1 Answers

Do it inside of the mark up. In the code behind on page load, set the Is_Manager flag and look it up from the database. Then, in the markup, do this:

<% if(Is_Manager){%>
 <li><a href="ManagerServicesHome.aspx">Manager Services</a></li>
<%}%>
like image 125
Bill Martin Avatar answered Oct 19 '25 22:10

Bill Martin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!