2012-12-04 57 views
0

也許有人可以解釋爲什麼EditorForModel和DisplayForModel不在Web頁面上顯示任何數據?EditorForModel和DisplayForModel不起作用,然後在類模型中傳遞類模型

public class QueueManagerModel 
    { 
     public RemoveModel Remove { get; set; } 
     public StatisticModel Statistic { get; set; } 


     public class RemoveModel 
     { 
      public bool Deleted { get; set; } 
      public bool ValidationFailled { get; set; } 
      public bool Validated { get; set; } 
      public bool Uploading { get; set; } 
     } 

     public class StatisticModel 
     { 
      public int Deleted { get; set; } 
      public int ValidationFailled { get; set; } 
      public int Validated { get; set; } 
      public int Uploading { get; set; } 
     } 

    } 

    public ActionResult QueueManager() 
     { 
      var queueManagerModel = new QueueManagerModel(); 
      queueManagerModel.Remove = new QueueManagerModel.RemoveModel(); 
      queueManagerModel.Statistic = new QueueManagerModel.StatisticModel(); 
      return View(queueManagerModel); 
     } 

@model PC.Models.QueueManagerModel 
@using (Html.BeginForm()) 
{ 
    <fieldset> 
     <legend>Queue Manager</legend> 
     @Html.EditorForModel(Model.Remove) 
     @Html.DisplayForModel(Model.Statistic) 
     <p> 
      <input type="submit" value="Save" /> 
     </p> 
    </fieldset> 
} 

回答

0

默認EditorForModelDisplayForModel不顯示或遞歸的複雜性質。你可以通過實現一個Object.cshtml模板來啓用它。

相關問題