开发者

How to show/hide an area within Razor View in ASP.NET MVC programmatically

开发者 https://www.devze.com 2023-03-23 13:37 出处:网络
I want to programmatically show/hide a group of fields (label, textfield, checkbox) on Razor view (.cshtml), based on a model value. The 开发者_开发技巧model is access to the view.

I want to programmatically show/hide a group of fields (label, textfield, checkbox) on Razor view (.cshtml), based on a model value. The 开发者_开发技巧model is access to the view.

Thanks


In your Razor View cshtml:

@if(Model.RevealSecretPlans)
{
    <div>
      Giant frikkin laser
    </div>
}

This of course assumes RevealSecretPlans is a boolean

0

精彩评论

暂无评论...
验证码 换一张
取 消