Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144850 | May 25,2019 03:19 PM UTC | Mar 31,2020 10:49 AM UTC | ASP.NET MVC - EJ 2 | 5 |
![]() |
Tags: Grid |
[Index.cshtml]
<div id="main">
@Html.EJS().Button("primarybtn").Content("Show the Grid in Partial View").IsPrimary(true).Render()
</div>
<div id="GridJ2" />
<script type="text/javascript">
// click event to call ajac post to server
document.getElementById("primarybtn").addEventListener("click", function () {
var ajax = new ej.base.Ajax("/Home/ProductpartialEJ2/", 'POST', true);
ajax.send().then((data) => {
$("#GridJ2").html(data);
});
});
</script>
……………………..
[HomeController.cs]
public ActionResult ProductpartialEJ2()
{
if(order.Count == 0)
BindDataSource();
var model = order;
ViewBag.data = order;
return PartialView("_GridFeaturesJ2", ViewBag);
}
……………………..
[_GridFeaturesJ2.cshtml]
@Html.EJS().Grid("GridJ2").DataSource((IEnumerable<object>)ViewBag.data).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("75").Add();
col.Field("CustomerID").HeaderText("Customer ID").Width("80").Add();
col.Field("OrderDate").HeaderText("Order Date").Format("yMd").Width("75").Add();
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("75").Add();
}).AllowPaging().PageSettings(p => p.PageSize(10)).Render()
@Html.EJS().ScriptManager()
|
Hi Adam,Thanks for your update.We are happy that the problem has been resolved at your end.Regards,Thavasianand S.
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.