在 mvc.grid 中筛选网格后停止页面刷新
Stop page refresh after filtering grid in mvc.grid
我正在使用 Mvc.Grid (Grid.MVC5),我想停止其在使用任何过滤器后自动调用的页面刷新。可能吗?
查看:-
@model IEnumerable< MVC6_Grid_with_filters.Models.SchemeMaster>
@using NonFactors.Mvc.Grid;
@{
Layout = null;
}
< link href="@Url.Content("~/Content/MvcGrid/mvc-grid.css")" rel="stylesheet" />
< script src="~/Scripts/jquery-2.1.4.min.js">< /script>
< script src="~/Scripts/MvcGrid/mvc-grid.js" type="text/javascript">< /script>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(c => c.SchemeID).Titled("SchemeID");
columns.Add(c => c.SchemeName).Titled("SchemeName");
columns.Add(c => c.city).Titled("City Name");
columns.Add(o => o.CompanyName).Titled("Company Name");
columns.Add(c => c.Createddate, "Createddate").Titled("Date");
columns.Add(c => c.Married).Titled("Married");
})
.Filterable()
.Sortable()
.Pageable()
)
<script>
$('.mvc-grid').mvcgrid();
</script>
您可以在局部视图中使用 @Html.AjaxGrid
控制器:
[HttpGet]
public ActionResult Index()
{
// Only main string query values will be visible here.
return View();
}
[HttpGet]
public ActionResult IndexGrid()
{
var list = GetSchemeMasters(); // Your custom list method to get SchemeMasters
return PartialView("YourPartialView", PeopleRepository.GetPeople());
}
主视图:
@Html.AjaxGrid(Url.Action("YourPartialAction"))
您的局部视图:
@model IEnumerable< MVC6_Grid_with_filters.Models.SchemeMaster>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(c => c.SchemeID).Titled("SchemeID");
columns.Add(c => c.SchemeName).Titled("SchemeName");
columns.Add(c => c.city).Titled("City Name");
columns.Add(o => o.CompanyName).Titled("Company Name");
columns.Add(c => c.Createddate, "Createddate").Titled("Date");
columns.Add(c => c.Married).Titled("Married");
})
.Pageable()
.Filterable()
.Sortable()
)
我正在使用 Mvc.Grid (Grid.MVC5),我想停止其在使用任何过滤器后自动调用的页面刷新。可能吗?
查看:-
@model IEnumerable< MVC6_Grid_with_filters.Models.SchemeMaster>
@using NonFactors.Mvc.Grid;
@{
Layout = null;
}
< link href="@Url.Content("~/Content/MvcGrid/mvc-grid.css")" rel="stylesheet" />
< script src="~/Scripts/jquery-2.1.4.min.js">< /script>
< script src="~/Scripts/MvcGrid/mvc-grid.js" type="text/javascript">< /script>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(c => c.SchemeID).Titled("SchemeID");
columns.Add(c => c.SchemeName).Titled("SchemeName");
columns.Add(c => c.city).Titled("City Name");
columns.Add(o => o.CompanyName).Titled("Company Name");
columns.Add(c => c.Createddate, "Createddate").Titled("Date");
columns.Add(c => c.Married).Titled("Married");
})
.Filterable()
.Sortable()
.Pageable()
)
<script>
$('.mvc-grid').mvcgrid();
</script>
您可以在局部视图中使用 @Html.AjaxGrid
控制器:
[HttpGet]
public ActionResult Index()
{
// Only main string query values will be visible here.
return View();
}
[HttpGet]
public ActionResult IndexGrid()
{
var list = GetSchemeMasters(); // Your custom list method to get SchemeMasters
return PartialView("YourPartialView", PeopleRepository.GetPeople());
}
主视图:
@Html.AjaxGrid(Url.Action("YourPartialAction"))
您的局部视图:
@model IEnumerable< MVC6_Grid_with_filters.Models.SchemeMaster>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(c => c.SchemeID).Titled("SchemeID");
columns.Add(c => c.SchemeName).Titled("SchemeName");
columns.Add(c => c.city).Titled("City Name");
columns.Add(o => o.CompanyName).Titled("Company Name");
columns.Add(c => c.Createddate, "Createddate").Titled("Date");
columns.Add(c => c.Married).Titled("Married");
})
.Pageable()
.Filterable()
.Sortable()
)