简体   繁体   中英

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

I have designed a view using some of the Kendo Telerik controls. 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?

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

Use the Kendo().TextBoxFor method:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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