Asp.net MVC Visible / Hide

This is a simple task in ASP.NET WebForms: if you want to show / hide the control, you need to set "Visible = true" or "Visible = false".

However, I do not know how to do this in MVC. I have a DIV, in my opinion, that should show / hide, depending on the check on the server.

<div class="divWarning">
Test
</div>

I need to show or hide its dynamic, but it must be controlled by the server.

Any ideas?

+5
source share
1 answer
<% if(Model.ShowYourDiv){ %>

   <div class="divWarning">
   Test
   </div>

<% } %>

div will only be displayed when the property ShowYourDiv true.

+11
source

All Articles