Index.cshtml
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.datasource).ActionComplete("actionComplete").AllowPaging(true).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").EditType("dropdownedit").IsPrimaryKey(true).Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
}).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "cancel"}).Render()
<script>
function actionComplete(args) {
if (args.requestType === 'add' || args.requestType === 'beginEdit') {
var buttons = args.dialog.element.getElementsByTagName('button');
buttons[1].style.color = 'Black';
buttons[1].style.backgroundColor = 'White';
}
}
</script>
<style>
.e-gridform .e-rowcell .e-float-input.e-input-focus
{
border-color: #b54545 !important;
}
.e-dropdownbase .e-list-item.e-active,.e-gridform .e-dropdownbase .e-list-item.e-active.e-hover {
background-color: #b54545 !important;
}
</style> |