简体   繁体   English

如果条件在剃刀视图中为true,则呈现html helper

[英]render a html helper if condition is true in razor view

I am rendering a html display helper if condition is true but when i debuged the code condition is true but html helper is not rendering . 如果condition为true,我正在渲染html display helper,但是当我调试代码为true时,html helper没有渲染。

code

        <td> 
        @if(item.securityGate==true)
        {
      @Html.Display("securityGate")
        }
        </td>

i am checking condtion in column of a table. 我正在检查表列中的状态。

Try like this: 尝试这样:

@if(item.securityGate){
       Html.Display("securityGate")

   }

hope this will help you. 希望这会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM