or
// aspx page codevar new_url = "/getdata.aspx?dt="+ date_passed var data_source1 = new kendo.data.DataSource({ transport: { read: { url: new_url, dataType: "json" }, cache: true }, pageSize: 100, page: 1 }); var grid_updated = $("#gridAllRuns").kendoGrid({ dataSource: data_source1, dataBound: onDataBound, height: $(document).height() - 250, groupable: true, sortable: true, columnMenu: true, reorderable: true, resizable: true, pageable: { refresh: true, pageSizes: [100, 500, 1000], pageSize: 100, buttonCount: 10 }, filterable: { extra: false, operators: { string: { eq: "equal to", startswith: "starts with", neq: "not equal to" } } }, toolbar: kendo.template($("#template").html()), columns: [{ title: "Firstname", field: "fname"}, { title: "Lastname", field: "lname"}]});// getdata.aspx.vb code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim for_date As String = Request.QueryString("dt")Dim get_data As String = "select fname, lname where dt_passed ='" & for_date & "' order by fname" Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri Dim data As String = "" Dim constr As String = constr Dim connection As New MySqlConnection(constr) connection.Open() Dim command As New MySqlCommand(get_data, connection) command.CommandType = System.Data.CommandType.Text Dim da As New MySqlDataAdapter() da.SelectCommand = command Dim dt As New DataTable() da.Fill(dt) 'Console.Write(GetJson(dt)) Response.Clear() Response.ContentType = "application/json; charset=utf-8" Response.Write(GetJson(dt)) Response.End()end subPublic Function GetJson(ByVal dt As DataTable) As String Dim serializer As New System.Web.Script.Serialization.JavaScriptSerializer() serializer.MaxJsonLength = 107869240 Dim rows As New List(Of Dictionary(Of String, Object))() Dim row As Dictionary(Of String, Object) = Nothing For Each dr As DataRow In dt.Rows row = New Dictionary(Of String, Object)() For Each col As DataColumn In dt.Columns row.Add(col.ColumnName.Trim(), dr(col)) Next rows.Add(row) Next Return serializer.Serialize(rows) End Function[ { "fname": "john", "lname": "Lane" }, { "fname": "Kim", "lname": "William" }............................// huge data]public class AgentModel //shown in a agent Grid { public int AgentID { get; set; } public string Name { get; set; } //column is shown in agent grid add/edit popup as a field on Tabstrip1 public StateModel State { get; set; } //similar to above field public Boolean IsActive { get; set; } //similar to above field public List<AgentWiterModel> AgentWiters { get; set; } // Shown in AgentWriter grid on Tabstrip2 when add/edit of master Agent grid. }public class AgentWriterModel { public int AgentID { get; set; } //read only public string AgencyID { get; set; } public WriterModel Writer { get; set; } }public class WriterModel { public int WriterID{get;set;} //want to bind this value on popup public string Code{get;set;} public string Name { get; set; } //want to bind and show on popup public Boolean IsActive { get; set; } }schema: { model: { id: "AgentID", Name: "Name", State: "State", IsActive: "IsActive", AgentWiters: "AgentWiters", fields: { AgentID: { type: "int", validation: { required: true} }, Name: { type: "string", validation: { required: true} }, State: { defaultValue: { Value: "", Text: "" }, validation: { required: true} }, IsActive: { type: "boolean", defaultValue: true } } } }On Edit of above model in a agent grid ;will open a below model in a new grid .Which I am facing difficulty to map perfect data-model.schema: { model: { id: "Writer.WriterID", Writer:"Writer", AgentID: "AgentID", AgencyID: "AgencyID", fields: { WriterID: { type: "string", defaultValue: ""}, Writer: { defaultValue: { WriterID: "", Name: ""} }, AgentID: { type: "int" }, AgencyID: { type: "string", validation: { required: true} }, } } } Here I want the Writer grid to map with columns like Writer.WriterID ,Writer.Name and AgencyID to add or edit into Agentwriter Grid.
columns: [
{ field: "AgentID", title: "AgentID", hidden: true },
//{ field: "Writer.WriterID", title: "WriterID", hidden: true },
{ field: "Writer.Name", title: "WriterName" },
{ field: "AgencyID", title: "Agency ID"},
{ field: "Writer.IsActive", title: "Status", hidden: true },
]<table>
<tr> <td> <label for="Writer" class="required">Name * :</label> </td> <td> <input id="Writer" name="Writer" data-bind="value:Writer" /> </td> </tr> <tr> <td> <label for="WriterID" class="required">Writer ID * :</label> </td> <td> <input type="text" id="WriterID" class="k-input k-textbox" name="WriterID" data-bind="value:Writer.WriterID" /> </td> </tr> <tr> <td> <label for="AgencyID" class="required">Agency ID * :</label> </td> <td> <input type="text" id="AgencyID" class="k-input k-textbox" name="AgencyID" data-bind="value:AgencyID" /> </td> </tr>
</table>
$("#datepicker").kendoDatePicker({
value: today,
dates: previousEntries,
month: {
content: ''
},
open: function (e) {
var datepicker = $("#datepicker").data("kendoDatePicker");
datepicker.dates = previousEntries.slice();
},
change: onDateChange
});
function onDateChange(e) {
document.getElementById("selectedDate").value = e.sender.value();
if(isInArray(e.sender.value(), e.sender.dates)) {
previousEntriesInfoDataSource.read();
}
}