参考:
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前面不用加@
时间: 2024-10-14 05:08:46