Master Details View - AllowEditing some columns problem


Im having some issues with the property AllowEditing,
I want to be able to set some columns of the master details as editable and others as non-editable but I havent managed to do it.

I have tried many things and also followed the tutorials but with no success.

https://help.syncfusion.com/windowsforms/datagrid/masterdetailsview#defining-properties-for-detailsviewdatagrid
https://help.syncfusion.com/windowsforms/datagrid/editing

Tried using AutoGeneratingRelations and AutoGeneratingColumn events, tried acessing directly the master details column and modifying it on DetailsViewLoading.


Using AutoGeneratingRelations and AutoGeneratingColumn

public FormTest()
{
InitializeComponent();
DataGrid.AutoGeneratingRelations += DataGrid_AutoGeneratingRelations;
}

private void DataGrid_AutoGeneratingRelations(object sender, AutoGeneratingRelationsEventArgs e)
{
e.GridViewDefinition.DataGrid.AllowEditing = false;
e.GridViewDefinition.DataGrid.AutoGeneratingColumn += DataGrid_AutoGeneratingColumn;
}

private void DataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
if (e.Column.MappingName == "Select" || e.Column.MappingName == "Process")
{
e.Column.AllowEditing = true;
}
}


Using DetailsViewLoading and managing it directly

private void DataGrid_DetailsViewLoading(object sender, DetailsViewLoadingAndUnloadingEventArgs e)
{
DataGrid.DetailsViewDefinitions[0].DataGrid.AllowEditing = false;
DataGrid.DetailsViewDefinitions[0].DataGrid.Columns["Select"].AllowEditing = true;
DataGrid.DetailsViewDefinitions[0].DataGrid.Columns["Process"].AllowEditing = true;
}

Its stated on the guide for the DataGrid that the Columns AllowEditing as priority over the Grid AllowEditing but it seems it is not working or most likely Im doing something wrong.

Also tried to manipulate it on CurrentCellBeginEdit event but the column of type bit/boolean represented by checkbox dont trigger this event.

How would I go about making only some columns editable and others non editable?


4 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team November 3, 2020 02:32 PM UTC

Hi Hugo,

Thank you for contacting Syncfusion support.

We have created bug report for the reported issue”
Particular column does not editable when AllowEditing enabled for that column in MasterDetailsViewDataGrid”. Can you please confirm, which version you are using currently?

It will be helpful for us to provide patch in that version.

Regards,
Vijayarasan S



UN Unknown November 3, 2020 03:19 PM UTC

Two problems I noted that might be a bug or might be my lack of knowledge are:
- Cant make some columns readonly and others editable (SfDataGrid Master Details);
- Checkbox column does not trigger the event CurrentCellBeginEdit (SfDataGrid Master Details);

Im currently using the version 18.3.0.35


VS Vijayarasan Sivanandham Syncfusion Team November 4, 2020 11:06 AM UTC

Hi Hugo,

Thanks for the update.

Please find answer for your queries below 
S.No 
Queries 
Solutions 
 
 
 
I want to be able to set some columns of the master details as editable and others as non-editable but I havent managed to do it. 
 
We have created bug report for the reported issue “Particular column does not editable when AllowEditing enabled for that column in MasterDetailsViewDataGrid”. We will fix this issue and provide you with patch on November 17, 2020.

You can track the status of this report through the following feedback link,

Feedback link: https://www.syncfusion.com/feedback/19402/particular-column-does-not-editable-when-allowediting-enabled-for-that-column-in

Note: The provider feedback link is private, and you need to login to view this feedback. 
 
 
 
Cant make some columns readonly and others editable (SfDataGrid Master Details) 
 
 
Your requirement can be achieved by setting false value for the AllowFocus property in SfDataGrid. Please refer the below code, 
private void SfDataGrid1_AutoGeneratingRelations(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingRelationsEventArgs e) 
{             
            e.GridViewDefinition.DataGrid.AllowEditing = true; 
            e.GridViewDefinition.DataGrid.AutoGeneratingColumn += DataGrid_AutoGeneratingColumn; 
 
private void DataGrid_AutoGeneratingColumn(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingColumnArgs e) 
            if (e.Column.MappingName == "Name" || e.Column.MappingName == "City") 
            { 
                e.Column.AllowFocus = false; 
            }  
 
For more information, please refer the below UG link, 
 
 
 
 
 
Checkbox column does not trigger the event CurrentCellBeginEdit (SfDataGrid Master Details) 
 
 
When click the CheckBox Column does not trigger the CurrentCellBeginEdit event in SfDataGrid. This is the Behavior of our control. Your requirement can be achieved by using SfDataGrid.CellCheckBoxClick event in SfDataGrid.  
 
private void SfDataGrid1_AutoGeneratingRelations(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingRelationsEventArgs e) 
{             
            e.GridViewDefinition.DataGrid.AllowEditing = true;             
            e.GridViewDefinition.DataGrid.CellCheckBoxClick += DataGrid_CellCheckBoxClick; 
} 
 
private void DataGrid_CellCheckBoxClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellCheckBoxClickEventArgs e) 
{ 
          e.Cancel = true; 
} 
 
For more information, please refer the below UG link, 
 
 

We hope this helps. Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S 


Marked as answer

MA Mohanram Anbukkarasu Syncfusion Team November 17, 2020 04:10 PM UTC

Hi Hugo, 

Thanks for your patience  

The issue “Particular column does not editable when AllowEditing enabled for that column in MasterDetailsViewDataGrid” has been fixed and the patch for this fix can be downloaded from the following location.   

Recommended approach - exe will perform automatic configuration  
Please find the patch setup from below location:  

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment  
Please find the patch assemblies alone from below location:  

Assembly Version: 18.3.0.35 
Installation Directions :   
This patch should replace the files “Syncfusion.SfDataGrid.WinForms” under the following folder.  
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]  
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\18.3.0.35\precompiledassemblies\18.3.0.35\4.0  

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.  


Note :   
To change how you receive bug fixes, ask your license management portal admin to change your project’s patch delivery mode.  


Disclaimer :   
Please note that we have created this patch for version 18.3.0.35 specifically to resolve the following issue(s) reported in this/the forum(s). 159307  

If you have received other patches for the same version for other products, please apply all patches in the order received.  

Regards, 
Mohanram A. 


Loader.
Up arrow icon