MVC: Conditionally Display View link

Please see my other MVC articles.

Displaying Links Based on IF Logic

This article illustrates how to conditionally display a link within an MVC based on the results of an IF statement


As you can see in my View’s HTML, I am displaying a “Home” link and then, if the current user is part of the Administrator role, display a link to the “Admin” page, calling the default (Index) function for that controller. If the user’s current identity does not pass the test, nothing occurs.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s