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?
<% if(Model.ShowYourDiv){ %>
<div class="divWarning">
Test
</div>
<% } %>
The div will only show when the ShowYourDiv
property is true
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With