We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add column in edit dialog form

Hi, I have a grid with 9 columns, 3 of them with .visible(false). I need that those 3 columns, shows up in the edit dialog (dialog mode, not dialog template mode).

Thanks for your help.

Kind regards,

Juan J.

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team March 1, 2019 01:16 AM

Hi Juan, 

Greetings from Syncfusion. 

Based on your query we found that you want to add/edit the invisible columns in Grid without using the dialog template edit in Grid. we can achieve your requirement using the actionBegin event of Grid. 

Refer the below code example. 


    )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()) 
<script id="dialogtemplate" type="text/template"> 
    <div id="dialogTemp"> 
<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 

Refer the help documentation. 

Thavasianand S. 

JJ Juan José March 1, 2019 09:26 AM

Thanks so much!

TS Thavasianand Sankaranarayanan Syncfusion Team March 3, 2019 11:10 PM

Hi Juan, 
We are happy that the problem has been solved. 
Please get back to us if you need any further assistance.  
Thavasianand S.

Live Chat Icon For mobile
Up arrow icon