Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143026 | Mar 1,2019 02:24 AM UTC | Mar 4,2019 04:10 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Grid |
[Index.cshtml]
@(@Html.EJS().Grid<DialogTemplateModel>("DialogTemplateEdit").ActionBegin("actionBegin").DataSource((IEnumerable<object>
)ViewBag.data).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();
col.Field("EmployeeID").HeaderText("Employee ID").Visible(false).Width("90").Add();
}).AllowPaging().PageSettings(page => page.PageCount(2)).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())
</div>
<script id="dialogtemplate" type="text/template">
<div id="dialogTemp">
</div>
</script>
<script type="text/javascript">
function actionBegin(args) {
if (args.requestType === "beginEdit" || args.requestType === "add") {
this.columns[2].visible = true; // Enable the visibility for “EmployeeID” column
}
else if (args.requestType === "save") {
this.columns[2].visible = false; // Disable the visibility for “EmployeeID” column
}
}
|
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.