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
close icon

Can not change the editor type and the group at the same time.

Hello,

When using event to customize a DataForm, we can not change the editor type and the group at the same time

in the code example below DataFormItem can not be the MultilineText and belong to Group Details.

Line of code    e.DataFormItem.Editor = "MultilineText";  hide the Details group. It's really strange.


  private void DataForm_AutoGeneratingDataFormItem(object sender, AutoGeneratingDataFormItemEventArgs e)
        {
            if (e.DataFormItem != null)
            {
                if (e.DataFormItem.Name == "Code" || e.DataFormItem.Name == "Name")
                    e.DataFormItem.GroupName = "General";
                else
                {
                    e.DataFormItem.GroupName = "Details";
                    e.DataFormItem.Editor = "MultilineText";
                }
                    
            }
        }

2 Replies

TU Tung September 12, 2019 02:11 PM UTC



KA Karthikraja Arumugam Syncfusion Team September 13, 2019 12:00 PM UTC

Hi Tung, 
 
Thank you for contacting Syncfusion support. 
 
Based on the shared information we have checked the reported issue “Cannot change GroupName and Editor of DataFormItem at same”. If you provide DataFormItem GroupName it will be added into DataFormGroupItems so you need to change editor of DataFormItem inside DataFormGroupItem.   
 
Please refer the following code example for the same, 
  
[C#]      
  
private void DataForm_AutoGeneratingDataFormItem(object sender, AutoGeneratingDataFormItemEventArgs e) 
        { 
            if (e.DataFormItem != null) 
            { 
                if (e.DataFormItem.Name == "Code" || e.DataFormItem.Name == "Name") 
                    e.DataFormItem.GroupName = "General"; 
                else 
                { 
                    e.DataFormItem.GroupName = "Details"; 
                } 
 
            } 
            if(e.DataFormGroupItem != null && e.DataFormGroupItem.GroupName == "Details") 
            { 
                foreach (var item in e.DataFormGroupItem.DataFormItems) 
                    (item as DataFormItem).Editor = "MultilineText"; 
            } 
        } 
 
 
We have prepared a sample based on your requirement, please find the sample by the following link. 

Sample link: DataFormGroupItem 
   
We hope this helps. Please let us know, if you need any further assistance. 
  
Regards,
Karthik Raja A 


Loader.
Live Chat Icon For mobile
Up arrow icon