Controller Method:
public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
{
if (invoices != "fail")
{
List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);
return Json(customer.ToDataSourceResult(request));
}
else
{
//do nothing
}
}
I am trying to upgrade the grid using ajax
$.ajax({
url: webManager.resolveUrl("~/maint/GetCustomerComments"),
method: "POST",
data: { invoices: invoicesList },
success: function () {
var grid = $('#CustomerCommentsGrid').data('kendoGrid');
grid.dataSource.read();
grid.refresh();
},
error: function () {
alert('an error occurred');
}
});
But the problem is Grid is called again and I want to stop that.
@(Html.Kendo().Grid<CustomerComments>()
.Name("CustomerCommentsGrid")
.Columns(columns =>
{
columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);
columns.Bound(i => i.Comment).Title("Comment").Width(40);
}).Pageable(pageable => pageable
.Refresh(true)
)
.Scrollable()
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax().UseJniErrorHandler()
.PageSize(10)
.Read(read => read.Action("GetCustomerComments", "Maint", new { invoices = "fail" }))
)
)
public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
{
if (invoices != "fail")
{
List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);
return Json(customer.ToDataSourceResult(request));
}
else
{
//do nothing
}
}
I am trying to upgrade the grid using ajax
$.ajax({
url: webManager.resolveUrl("~/maint/GetCustomerComments"),
method: "POST",
data: { invoices: invoicesList },
success: function () {
var grid = $('#CustomerCommentsGrid').data('kendoGrid');
grid.dataSource.read();
grid.refresh();
},
error: function () {
alert('an error occurred');
}
});
But the problem is Grid is called again and I want to stop that.
@(Html.Kendo().Grid<CustomerComments>()
.Name("CustomerCommentsGrid")
.Columns(columns =>
{
columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);
columns.Bound(i => i.Comment).Title("Comment").Width(40);
}).Pageable(pageable => pageable
.Refresh(true)
)
.Scrollable()
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax().UseJniErrorHandler()
.PageSize(10)
.Read(read => read.Action("GetCustomerComments", "Maint", new { invoices = "fail" }))
)
)