@(Html.EJ().Grid<Sample118577.OrdersView>("FlatGrid")
.Datasource(Model)
.--------------------------------------------
.Columns(col =>
{
------------------------
col.Field("EmployeeID").HeaderText("Employee Name").EditType(EditingType.Dropdown).TextAlign(TextAlign.Left).DataSource((List<object>)ViewData["EmployeeID"]).Width(90).Add();
------------------------
})
)
--------------------------------------------------------
public ActionResult GridFeatures(string id)
{
--------
ViewData["EmployeeID"] = EmployeeID;
----
}
public List<object> EmployeeID
{
get
{
var employeeID = db.OrdersViews.Select(s => s.EmployeeID).Distinct().ToList();
var EmployeeID = new List<object>();
foreach (var id in employeeID)
{
EmployeeID.Add(new { value = id, text = id });
}
return EmployeeID;
}
} |