@(Html.EJ().Grid<SyncfusionMvcApplication89.OrdersView>("FlatGrid")
..
.ClientSideEvents(eve => { eve.ActionComplete("complete"); })
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template"); })
.Columns(col =>
{
col.Field("EmployeeID").HeaderText("Employee ID").EditType(EditingType.Dropdown).Visible(false).TextAlign(TextAlign.Right).Width(75).Add();// this column will be hidden initial rendering of the grid
}))
<script type="text/template" id="template">
<b>Order Details</b>
<table cellspacing="10">
..
<tr>
<td style="text-align: right;">
Employee ID
</td>
<td style="text-align: left">
<select id="EmployeeID" name="EmployeeID">
</select>
</td>
..
</table>
</script>
<script type="text/javascript">
function complete(args) {
var data = @(Html.Raw(Json.Encode(ViewBag.dropdown)));
if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialogtemplate") {
$("#EmployeeID").ejDropDownList({dataSource: data, width: '116px' }); // here we will bind datasource for dropdown column
..
}
}
}
</script>
|