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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add column in edit dialog form

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
loading
Tags: Grid
Juan José
Asked On March 1, 2019 02:24 AM UTC

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.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 1, 2019 06:16 AM UTC

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. 


[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 
        } 
    } 



Refer the help documentation. 


Regards, 
Thavasianand S. 


Juan José
Replied On March 1, 2019 02:26 PM UTC

Thanks so much!

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 4, 2019 04:10 AM UTC

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

CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;