or
Code Kendo UI Fluent
@(Html.Kendo().Chart() .Name("Chart").DataSource(ds => ds.Read(read => read.Action("ActionName", "ControllerName").Data("filterFunction")))
Code JavaScript
jQuery(document).ready(function($) { $("#chart").kendoChart({ dataSource: { transport: { read: "ControllerName/ActionName", parameterMap: filterFunction }},@(Html.Kendo().DropDownListFor(model => model.Project) .Name("Project") .DataTextField("ProjectCode") .DataValueField("ProjectCode") .DataSource(source => { source.Read(read => { read.Action("GetProjects", "NewTimesheet"); }); }) .Events(e => e.Select("projectChange")) .SelectedIndex(0) )var MyModel = kendo.data.Model.extend();
var MyDataSource = kendo.data.DataSource.extend({
options: {
transport: {
create: {
url: 'dummy.json',
type: 'GET',
dataType: 'json'
},
read: {
url: 'dummy.json',
type: 'GET',
dataType: 'json'
},
update: {
url: 'dummy.json',
type: 'GET',
dataType: 'json'
},
destroy: {
url: 'dummy.json',
type: 'GET',
dataType: 'json'
}
},
schema: {
model: MyModel,
data: 'data',
total: 'total'
}
}
});
var myDataSource = new MyDataSource();
var myModel = new MyModel({
ding: 'dong',
ping: 'pong'
});
myDataSource.add(myModel);
myDataSource.sync();
columns: [ { field: "Choices", title: "My Choices", width: "150px", editor: function(container, options) { $('<input data-text-field="Name" data-value-field="Value" data-bind="value:' + options.field + '"/>').appendTo(container).kendoDropDownList({ dataSource: { data: myChoicesArray }, dataValueField: "Value", dataTextField: "Name", autobind: true }); } }, { command: ["edit", "destroy"], title: " ", width: "210px" }],data-value-field="Value", I get the value (incorrectly) appearing in the grid and the viewModel correctly gets the value. On the otherhand, if I set data-value-field="Name", I get the text correctly appearing in the grid but then the viewModel incorrectly gets the text too. I would like to have the text of the DropDownList choice appear in grid and the value of the choice stored in the viewModel. How can I do this?<%
= Html.Telerik().TreeView()
.Name("TreeView")
.BindTo(Model, mappings =>
{
mappings.For<Employees>(binding => binding
.ItemDataBound((item, emp) =>
{
item.Text = emp.EmpName;
}));
})
%>
<div id="example" class="k-content"><table id="grid" style="float: left; position: relative"> <thead> <tr> <th width ="310px"data-field="FileName">File Name </th> <th width ="290px"data-field="ID">File Identifier </th> </tr> </thead> <tbody> @foreach (var item in Model) { <tr > <td class="idRank" > @item.FileName </td> <td class="idRank2" > @item.ID </td> </tr> } </tbody>