简体   繁体   English

如何将Kendo Textbox控件绑定到其数据?

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

I have designed a view using some of the Kendo Telerik controls. 我使用了一些Kendo Telerik控件设计了一个视图。 I am not sure how to bind their controls to data. 我不知道如何将他们的控件绑定到数据。

This generated scaffolded method works : 这个生成的脚手架方法有效:

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

How do I bind the Kendo Textbox? 如何绑定Kendo文本框?

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

Use the Kendo().TextBoxFor method: 使用Kendo().TextBoxFor方法:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM