ASP.NET Razor - html中使用if else

参考:

http://www.runoob.com/aspnet/razor-cs-loops.html

      <select id="task_isfirst" class="form-control savedata" >
      @if (Model.isfirst == true)
      {              
          <option value='true' selected='selected'>是</option>  
          <option value='false' >否</option>
      }
      else
      {
          <option value='true'>是</option>  
          <option value='false' selected='selected'>否</option>
      }     
     
      </select>

注意:else前面不用加@

posted @ 2015-11-25 16:53  金河  阅读(1063)  评论(0编辑  收藏  举报