BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
@using gridmvclocalization.Models;
@Html.EJS().Grid("Complex").DataSource((IEnumerable<object>)ViewBag.LocalData).Columns(col =>
{
col.Field("EmployeeID").Width("120").HeaderText("EmployeeID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Add();
Country filter1 = new Country();
foreach (var prop in filter1.GetType().GetProperties())
{
col.Field("Country."+ prop.Name).Width("120").HeaderText(prop.Name).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Add();
}
}).AllowPaging().Render() |
public ActionResult Index()
{
ViewBag.LocalData = Complex.GetData();
return View();
} |
public class Country
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string CountryName { get; set; }
public int OrderID { get; set; }
}
public class Complex
{
public int EmployeeID {get; set; }
public Country Country { get; set; }
public static List<Complex> GetData()
{
List<Complex> Data = new List<Complex>();
Data.Add(new Complex() { EmployeeID = 10001, Country = new Country() { CountryName = "Australia", FirstName = "ANATR", LastName = "HANAR", OrderID = 10248 } });
Data.Add(new Complex() { EmployeeID = 10002, Country = new Country() { CountryName = "Bermuda", FirstName = "VINET", LastName = "CHOPS", OrderID = 10249 } });
.
.
.
.
.
});
return Data;
}
} |
public class Country
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string CountryName { get; set; }
public int OrderID { get; set; }
} |
public class Complex
{
public int EmployeeID {get; set; }
public Country Country { get; set; }
. . . . . .
}
|
foreach (var prop in filter1.GetType().GetProperties())
{
col.Field("Country."+ prop.Name).Width("120").HeaderText(prop.Name).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Add();
}
|