views:

100

answers:

1

That's a simple task in ASP.NET WebForms:If you want to show/hide a control all you need to do is set "Visible=true" or "Visible=false".

However,i dont know how to accomplish that in MVC.I have a DIV in my view that needs to show/hide,depending validation on server.

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

I need to show or hide it dynamic,but needs to be controlled by server.

Any ideias?

+4  A: 
<% if(Model.ShowYourDiv){ %>

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

<% } %>

The div will only show when the ShowYourDiv property is true.

jwsample