Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147660 | Sep 18,2019 11:34 PM UTC | Sep 23,2019 06:58 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Grid |
[Index.cshtml]
@Html.EJS().Grid("Grid").AllowPaging().Load("Load").DataSource(ds => { ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor"); }).Columns(col =>
{
. . . .
}).AllowPaging().PageSettings(page => page.PageSize(15).PageCount(10)).Render()
<script>
document.getElementById("btnViewReport").addEventListener("click", function () {
var gridObj = document.getElementById("Grid").ej2_instances[0];
gridObj.showSpinner(); // show the spinner
var Ajax = new ej.base.Ajax({
type: "POST",
url: "/Home/getDate",
contentType: "application/json; charset=utf-8",
});
Ajax.send();
Ajax.onSuccess = function (result) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
var data = new ej.data.DataUtil.parse.parseJson(result);
gridObj.dataSource = data;
gridObj.hideSpinner(); // We have hide the spinner while bind data in Grid
};
Ajax.onFailure = function (data) {
}
}) |
[index.cshtml]
document.getElementById("btnViewReport").addEventListener("click", function () {
var gridObj = document.getElementById("Grid").ej2_instances[0];
gridObj.showSpinner();
var Ajax = new ej.base.Ajax({
type: "POST",
url: "/Home/getDate",
contentType: "application/json; charset=utf-8",
data: JSON.stringify([{ memberGroupId: 1 }])
});
Ajax.send();
Ajax.onSuccess = function (result) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
var data = new ej.data.DataUtil.parse.parseJson(result);
gridObj.dataSource = data;
gridObj.hideSpinner();
};
Ajax.onFailure = function (data) {
}
})
[HomeController.cs]
public ActionResult getDate(List<memberGroup> id)
{
. . . .
return Json(order);
}
public class memberGroup {
public int memberGroupId { get; set; }
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.