// hide the column in the details view grid.
this.sfDataGrid1.DetailsViewDefinitions[0].DataGrid.Columns["OrderID"].Visible = false;
this.sfDataGrid1.DetailsViewDefinitions[0].DataGrid.Columns["ProductID"].Visible = false; |
this.sfDataGrid1.AutoGeneratingRelations += OnAutoGeneratingRelations;
private void OnAutoGeneratingRelations(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingRelationsEventArgs e)
{
e.GridViewDefinition.DataGrid.AutoGeneratingColumn += OnAutoGeneratingColumn;
}
private void OnAutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
//check the field to hide in ChildTable
if (e.Column.MappingName == "ID")
{
//hide the ID column by disable Visible property in GridColumn
e.Column.Visible = false;
}
} |
this.sfDataGrid1.AutoGeneratingRelations += OnAutoGeneratingRelations;
private void OnAutoGeneratingRelations(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingRelationsEventArgs e)
{
//Manually define columns
e.GridViewDefinition.DataGrid.AutoGenerateColumns = false;
e.GridViewDefinition.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "ID", HeaderText = "ID" ,Visible = false});
e.GridViewDefinition.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "Name", HeaderText = "Name" });
e.GridViewDefinition.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "City", HeaderText = "City" });
e.GridViewDefinition.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "Quantity", HeaderText = "Quantity" });
e.GridViewDefinition.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "UnitPrice", HeaderText = "Unit Price" });
} |