-1
我創建了添加/刪除列表項的視圖。我試圖處理添加/刪除動態,但我不清楚如何獲得正確的模板上下文時,清單是空的。空列表的模板/數據/模型上下文ASP.NET MVC2
的觀點是基於:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service.Cms.ListItems;
namespace Bcp.Service.Cms.Documents
{
public class Tasting //: Document
{
public Tasting() { }
public List<DocumentListItem> relatedCrap { get; set; }
}
}
相關貨品看起來是這樣的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Service.Cms.ListItems
{
public class DocumentListItem
{
public DocumentListItem() { }
public Int32 documentId { get; set; }
public String title { get; set; }
public String documentType { get; set; }
public String status { get; set; }
}
}
爲了保存列表項,每個屬性都需要與tastingInfo.relatedDocs.#PROPERTYNAME#
前綴 但如果列表爲空時,我加載視圖,我不知道如何訪問該上下文。任何人有任何想法?