我想設置文本框只讀,如果它在MVC中的視圖值。如何設置文本框只讀,如果它有價值?
所以我寫
<tr>
@if (model.first_name != "") {
<td >
@Html.LabelFor(model => model.first_name):
</td>
<td >
@Html.TextBoxFor(model => model.first_name)
<span class="required">*</span>
@Html.ValidationMessageFor(model => model.first_name)
</td>
@ else
<td >
@Html.LabelFor(model => model.first_name):
</td>
<td >
@Html.EditorFor(model => model.first_name)
<span class="required">*</span>
@Html.ValidationMessageFor(model => model.first_name)
</td>
@}
<td >
@Html.LabelFor(model => model.first_name):
</td>
<td >
@Html.EditorFor(model => model.first_name)
<span class="required">*</span>
@Html.ValidationMessageFor(model => model.first_name)
</td>
</tr>
但就是不工作.. 如何解決售後服務呢?? 我該怎麼做?
它不是編譯(括號丟失)還是有單獨的問題?發生什麼事? –