2013-11-04 93 views
0

我有一個簡單的類下面,我試圖用來在編輯器Kendo控件中顯示內容字符串。我遇到了將該屬性綁定到編輯器的問題。如何使用Razor將內容字符串綁定到Kendo UI Web/MVC編輯器?在Kendo UI編輯器中無法顯示內容

public class Details 
{ 
    public int TextId { get; set; } 
    public string Content { get; set; } 
} 

public List<Details> TextDetails 
{ 
    get 
    { 
     return mDetails; 
    } 
} 




@model MyApp.MyModels.ContentModel 

@{ 
    ViewBag.Title = "EditorContent"; 
} 

<h2>Stuff To Display</h2> 

@(Html.Kendo().Editor() 
.Name("editor") 
.Value(Model.TextDetails.Content) 
//I thought I could just bind to the property.... How can I show the Content in the Editor? 
) 

回答

1

你應該這樣做:Model.TextDetails.First().Content,否則一切都很好。如您所知Value()只需要一個字符串值並呈現爲html內容,提供適當的模型屬性(字符串)不應傷害編輯器。