2013-02-05 36 views
0

嗨,我正在建立一個網頁,顯示數據庫中的數據。就像這樣:如何使用文本返回字段?

enter image description here

爲什麼結果不顯示?最好,

@model Orchard.Staff.Models.StaffPart 
    <fieldset> 
     <legend>Map Fields</legend> 

     <div class="editor-label"> 
     @Html.LabelFor(model => model.StaffID) 
     </div> 
     <div class="editor-field"> 
     @Html.DisplayFor(model => model.StaffID) 
     @Html.ValidationMessageFor(model => model.StaffID) 
     </div> 
     <div class="editor-label"> 
     @Html.LabelFor(model => model.CName) 
     </div> 
     <div class="editor-field"> 
     @Html.DisplayFor(model => model.CName) 
     @Html.ValidationMessageFor(model => model.CName) 
     </div> 

     <div class="editor-label"> 
     @Html.LabelFor(model => model.EName) 
     </div> 
     <div class="editor-field"> 
     @Html.DisplayFor(model => model.EName) 
     @Html.ValidationMessageFor(model => model.EName) 
     </div> 

回答

1

使用

@Html.TextBoxFor(model => model.EName) 

代替,

@Html.DisplayFor(model => model.EName) 

如果還是不行,請確保您的模型被正確填充,然後再將其發送到視圖

嘗試
相關問題