Field Chooser for Data bound Grid in Windows Forms GridDataBoundGrid

26 Apr 20211 minute to read

This feature enables you to customize the view of the grid without modifying the database.The FieldChooser class of GridDataBoundGrid has been implemented to add or remove columns from a grid.

Use Case Scenarios

This feature will be useful when you want to remove certain columns (which cannot be deleted) from the grid.

Methods

TABLEMETHODS DESCRIPTION PARAMETERS TYPE RETURN TYPE REFERENCE LINKS
WireGrid Used to wire the

FieldChooser.

Overloads: ( Arg1) In GridWindowsForm Example: GridDataboundGrid1.WireGrid(GridDataBoundGrid). NA
UnWireGrid Used to unwire the FieldChooser. NA In GridWindowsForm Example: GridDataboundGrid1.Unwired(). NA

You can find a sample for this feature in the following location:

....\AppData\Local\Syncfusion\EssentialStudio[Version_Number]\Windows\GridDataBound.Windows\Samples\Product Showcase\GDBG FieldChooser Demo

Adding Field Chooser for GridDataBoundGrid

  1. To add field chooser, pass data bound grid as the parameter of the WireGrid method.

    The following code illustrates this:

GridDataBoundFieldChooser fChooser = new GridDataBoundFieldChooser();
fChooser.WireGrid(this.GridDataBoundGrid1);
Dim fChooser As GridDataBoundFieldChooser = New GridDataBoundFieldChooser()
fChooser.WireGrid(Me.GridDataBoundGrid1)
  1. When the code runs, the entire grid will open.
  2. Right click on a column header and select the Field Chooser menu item to view Field Chooser dialog.

    Windows Forms DataBoundGrid Image1

  3. This dialog will list all the column names with check boxes adjacent to them.

    Windows Forms DataBoundGrid Image2

  4. Select the checkboxes of the columns you want to be displayed in the grid.
  5. The grid will have only the columns which are selected in the Field Chooser dialog.

    Windows Forms DataBoundGrid Image3