如何将 Kendo 文本框控件绑定到它的数据?

How do I bind the Kendo Textbox control to its data?

我使用一些 Kendo Telerik 控件设计了一个视图。我不确定如何将他们的控件绑定到数据。

这个生成的脚手架方法有效:

@Html.EditorFor(model => model.surName, new { htmlAttributes = new { @class = "form-control" } })

如何绑定 Kendo 文本框?

@(Html.Kendo().TextBox()
    .Name("fName") 
    .HtmlAttributes(new { placeholder = "First Name", required = "required", validationmessage="Enter First Name" })
)

使用Kendo().TextBoxFor方法:

@(Html.Kendo().TextBoxFor(model => model.FirstName)
    .Name("fName")
    .HtmlAttributes(new { placeholder = "First Name", required = "required", validationmessage="Enter First Name" })
)