What is the reason for MappingName and Name properties should be same in ColumnDescriptor in WinForms GridGroupingControl?
Column descriptor
The GridColumnDescriptor has the MappingName, Name and header text properties. Please refer the below table to have a clarification in the purpose of these properties.
MappingName | The mapping for this column. You should specify which column of DataTable you want to display in the grid at this column. |
Name | The name of the column. If name is not specified, the MappingName will be assigned to Name. To specify a particular Name, the MappingName should also reflect that particular name. |
HeaderText | The header text displayed in the column header. If no header text has been specified, the header text will be the same as the Name. |
C#
//MappingName this.gridGroupingControl1.TableDescriptor.Columns[0].MappingName = "col1"; //Column Name this.gridGroupingControl1.TableDescriptor.Columns[0].Name = "col1"; //HeaderText this.gridGroupingControl1.TableDescriptor.Columns[0].HeaderText = "Column1";
VB
'MappingName Me.gridGroupingControl1.TableDescriptor.Columns(0).MappingName = "col1" 'Column Name Me.gridGroupingControl1.TableDescriptor.Columns(0).Name = "col1" 'HeaderText Me.gridGroupingControl1.TableDescriptor.Columns(0).HeaderText = "Column1"
The value of both Name and Mapping name should be defined with same name. Since the column has been validated using both MappingName and Name in source level. If they have different names the validation fails in certain cases.