Sanooj VS
Sanooj VS

Reputation: 279

Div's visibility based on model property in mvc

The following code not working. please help me to figure out this

 <div style="visibility: @(@Model.HasBackUp ? "block" : "none")"/>

Upvotes: 0

Views: 1768

Answers (2)

ssimeonov
ssimeonov

Reputation: 1426

You have to remove the @ in front of the Model so your code should look like this:

<div style="display: @(Model.HasBackUp ? "block" : "none")"/>

Upvotes: 3

Mahesh Reddy
Mahesh Reddy

Reputation: 356

<div style="display: @(Model.HasBackUp ? "block" : "none")"/>

Upvotes: 1

Related Questions