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" })
)
Bind data to Kendo Grid by using AJAX Read action method. Change the datasource on change event of any HTML controls. Normally, a developer can bind the data to Grid by using AJAX Read method. This read method is ActionResult method in MVC which will return JSON DataSourceResult & direclty bind the data to Grid.
Binds a HTML View to a View-Model and initializes Kendo UI widgets from DOM elements based on data-role attributes, similar to kendo. init(). Model View ViewModel (MVVM) is a design pattern which helps developers separate the Model from the View.
Since you are using the data method, you should be able to access the data via the properties and methods of the resulting object. You should be able to check the length of gridData via console. log(gridData. length) , as well checking any individual object within the data via an array index console.
Use the Kendo().TextBoxFor
method:
@(Html.Kendo().TextBoxFor(model => model.FirstName)
.Name("fName")
.HtmlAttributes(new { placeholder = "First Name", required = "required", validationmessage="Enter First Name" })
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With