I have a prolem while assigning data to control which is generated from another page. While routing to another page, I am not able to assign the selcted value to a text box.
Please help me in this regard. Code is below here:
@{
ViewBag.Title = "TaskDetailListView";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="formcontainer">
<div id="demo">
Order ID: <input data-bind="value: OrderID" /><br />
Shipment Name: <label data-bind="text: ShipName" ></label>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var productsSource = new kendo.data.DataSource({
transport: {
read: {
contentType: "application/json; charset=utf-8",
type: "GET",
dataType: "json",
url: "http://localhost:23794/api/Task/TaskItem"
}
},
schema: {
total: function (result) {
alert(JSON.stringify(result));
},
model: {
id: "OrderID",
fields: {
OrderID: { type: "number" },
ShipName: { type: "string" }
}
}
}
});
var viewModel = kendo.observable({
dataSource: productsSource
});
productsSource.fetch();
kendo.bind($("#formcontainer"), viewModel);
});
</script>