无法在Kendo UI Editor中显示内容

时间:2013-11-04 03:40:39

标签: asp.net-mvc-4 razor kendo-ui kendo-asp.net-mvc

我在下面有一个简单的类,我试图在Editor Kendo Control中显示Content字符串。我遇到了将Property绑定到编辑器的问题。如何使用Razor将内容字符串绑定到Kendo UI Web / MVC编辑器?

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 个答案:

答案 0 :(得分:1)

你应该这样做:Model.TextDetails.First().Content,否则一切都很好。如您所知Value()只需要一个字符串值并呈现为html内容,提供适当的模型属性(字符串)不应该损害编辑器。