Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Accessing Values in Windows Forms GridDataBoundGrid

To access values in the Grid Data Bound Grid, use the indexer and retrieve the value from the GridStyleInfo object.
To access values in the GridDataBoundGrid, use the indexer and retrieve the value from the GridStyleInfo object.

{% tabs %}
{% highlight c# %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation: ug

Binding to a DataTable is a very simple and straight-forward process. After defining DataTable, you must set GridDataBoundGrid.DataSource property to the table. Then you can easily use the Data Tab of your toolbox in Visual Studio to generate DataTables. Here we will add a simple People table using the code to illustrate how you can dynamically create a DataTable.

Creating a DataTable from code is a two-step process. You must first add DataColumn objects to the DataTable.Columns collection and then you must add DataRow objects to the DataTable.Rows collection. Given below is the code that does this. The code will assume that you have dropped a Grid Data Bound Grid onto the form.
Creating a DataTable from code is a two-step process. You must first add DataColumn objects to the DataTable.Columns collection and then you must add DataRow objects to the DataTable.Rows collection. Given below is the code that does this. The code will assume that you have dropped a GridDataBoundGrid onto the form.

{% tabs %}
{% highlight c# %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You can bind an ArrayList that holds objects with public properties. Given below

1. We first define an object called Person with two public properties: FirstName and LastName.
2. We then create an ArrayList holding a collection of these objects.
3. To bind this ArrayList to Grid Data Bound Grid, we set the grid's DataSource property after dropping Grid Data Bound Grid onto the form.
3. To bind this ArrayList to GridDataBoundGrid, we set the grid's DataSource property after dropping control onto the form.

Given below is the code sample for this.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Me.gridDataBoundGrid1.CurrentCell.ValidationErrorText = "this is the text"
{% endhighlight %}
{% endtabs %}

![Windows Forms Grid Image2](Built-in-Error-Provider-Support_images/Built-in-Error-Provider-Support_img2.png)
![Display error icon](Built-in-Error-Provider-Support_images/Built-in-Error-Provider-Support_img2.png)


## Specifying Error Content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Changing Column Order in Windows Forms GridDataBoundGrid

The simplest way to change the column order in a Grid Data Bound Grid is to use the GridDataBoundGrid.Model.Cols.MoveRange method. This method will rearrange columns that are based on from and to and counts the parameters passed into it.
The simplest way to change the column order in a GridDataBoundGrid is to use the GridDataBoundGrid.Model.Cols.MoveRange method. This method will rearrange columns that are based on from and to and counts the parameters passed into it.

{% tabs %}
{% highlight c# %}
Expand Down
18 changes: 9 additions & 9 deletions WindowsForms/Classic/DataBoundGrid/Data-Relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This section illustrates the following topics.

## Nested Drop-down Grids

Nested Drop-down grids are used to represent multi-level data in a grid. For example, if a bank wants to load all the accounts of an enrolled user in grid control for a financial project, and some of the accounts have sub accounts with options to be selected under each sub account, which need to be loaded/ shown as a sub element to that account, Nested Drop-down grids can be used to represent data. Data can be distributed in parent (primary) grid, child grid, and so on. Grid Data Bound Grid control can display hierarchical data using Nested Drop-down grids.
Nested Drop-down grids are used to represent multi-level data in a grid. For example, if a bank wants to load all the accounts of an enrolled user in grid control for a financial project, and some of the accounts have sub accounts with options to be selected under each sub account, which need to be loaded/ shown as a sub element to that account, Nested Drop-down grids can be used to represent data. Data can be distributed in parent (primary) grid, child grid, and so on. GridDataBoundGrid control can display hierarchical data using Nested Drop-down grids.

### Example

Expand Down Expand Up @@ -79,7 +79,7 @@ A sample demonstrating this feature is available under the following sample inst

## Multiple Nested Relations

Grid Data Bound Grid control supports multiple nested relations. A relation can be added in the data source and the data source can be set to GridDataBoundGrid. Then the name of the relation can be passed through Grid.Binder.AddRelation function to show a hierarchical pattern.
GridDataBoundGrid control supports multiple nested relations. A relation can be added in the data source and the data source can be set to the control. Then the name of the relation can be passed through Grid.Binder.AddRelation function to show a hierarchical pattern.

### Example

Expand All @@ -105,7 +105,7 @@ A sample demonstrating this feature is available under the following sample inst

## Hierarchical Grid with Tree Lines

Grid Data Bound Grid supports display of hierarchical grid with tree lines. This can be achieved by setting the ShowTreeLines property to _true_.
GridDataBoundGrid supports display of hierarchical grid with tree lines. This can be achieved by setting the ShowTreeLines property to _true_.

{% tabs %}
{% highlight c# %}
Expand All @@ -129,9 +129,9 @@ A sample demonstrating this feature is available under the following sample inst
## ExpandAll and CollapseAll Methods

1. ExpandAll
1. Using this method will enable the user to view expanded nodes in DataBound Grid, i.e., the parent, child and subsequent sub level nodes.
1. Using this method will enable the user to view expanded nodes in DataBoundGrid, i.e., the parent, child and subsequent sub level nodes.

The following code illustrates how to set this method for DataBound Grid:
The following code illustrates how to set this method for DataBoundGrid:

{% tabs %}
{% highlight c# %}
Expand All @@ -142,14 +142,14 @@ Me.gridDataBoundGrid1.ExpandAll()
{% endhighlight %}
{% endtabs %}

![Windows Forms Data-Relations Image4](Data-Relations_images/Data-Relations_img4.jpeg)
![Data-Relations Image4](Data-Relations_images/Data-Relations_img4.jpeg)



2. CollapseAll
3. Using this method will enable the user to view collapsed nodes in DataBound Grid, i.e., only the parent node can be viewed with its corresponding expansion icon.
3. Using this method will enable the user to view collapsed nodes in DataBoundGrid, i.e., only the parent node can be viewed with its corresponding expansion icon.

The following code illustrates how to set this method for DataBound Grid:
The following code illustrates how to set this method for DataBoundGrid:

{% tabs %}
{% highlight c# %}
Expand All @@ -159,4 +159,4 @@ Me.gridDataBoundGrid1.ExpandAll()
Me.gridDataBoundGrid1.CollapseAll()
{% endhighlight %}
{% endtabs %}
![Windows Forms Data-Relations Image5](Data-Relations_images/Data-Relations_img5.jpeg)
![Data-Relations Image5](Data-Relations_images/Data-Relations_img5.jpeg)
2 changes: 1 addition & 1 deletion WindowsForms/Classic/DataBoundGrid/Events.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Events in Windows Forms GridDataBoundGrid

The important events in Grid control and DataBound Grid are as follows.
The important events in Grid control and DataBoundGrid are as follows.

## Current Cell Related Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ fChooser.WireGrid(Me.GridDataBoundGrid1)
2. When the code runs, the entire grid will open.
3. Right click on a column header and select the Field Chooser menu item to view _Field Chooser_ dialog.

![Windows Forms DataBoundGrid Image1](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img1.png)
![Field-Chooser Image1](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img1.png)



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

![Windows Forms DataBoundGrid Image2](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img2.png)
![Field-Chooser Image2](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img2.png)



5. Select the checkboxes of the columns you want to be displayed in the grid.
6. The grid will have only the columns which are selected in the _Field Chooser_ dialog.

![Windows Forms DataBoundGrid Image3](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img3.png)
![Field-Chooser Image3](Field-Chooser-for-DataBound-Grid_images/Field-Chooser-for-DataBound-Grid_img3.png)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation: ug

We will use an example to illustrate filtering procedure for the grid.

Assume that you are binding a grid to DataTable. In this case, you will have to use DataView.RowFilter property to restrict the rows that appear in your Grid Data Bound Grid. The syntax for RowFilter clause is very similar to SQL WHERE clause. You will be able to see a full description of this in the .NET Frameworks online help for DataColumn.Expression, which uses the same syntax.
Assume that you are binding a grid to DataTable. In this case, you will have to use DataView.RowFilter property to restrict the rows that appear in your GridDataBoundGrid. The syntax for RowFilter clause is very similar to SQL WHERE clause. You will be able to see a full description of this in the .NET Frameworks online help for DataColumn.Expression, which uses the same syntax.

Here are some samples.

Expand Down Expand Up @@ -40,7 +40,7 @@ Name LIKE *a</td><td>
Shows only rows where the Name column ends with *a.</td></tr>
</table>

![Filtering-Grid-Data-Bound-Grid_img1](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img1.jpeg)
![Filtering_img1](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img1.jpeg)



Expand All @@ -62,11 +62,11 @@ dataView.RowFilter = "FirstName LIKE 's*'"
{% endhighlight %}
{% endtabs %}

You can use the Essential Grid's GridFilterBar class to automatically add a row of drop-down cells at the top of a simple (non-hierarchical) DataBound Grid that can be used to filter the grid to display only rows that match values from the drop-down. For example, when you have a grid with Grid Filter Bar, if one of your columns is City and you want to see all the rows where City is 'Boston' for example and then you will have to drop the combo box at the top of the City column and select Boston. The grid will then display only those rows with Boston in the City column. Adding a Grid Filter Bar takes only two lines of code.
You can use the Essential Grid's GridFilterBar class to automatically add a row of drop-down cells at the top of a simple (non-hierarchical) GridDataBoundGrid that can be used to filter the grid to display only rows that match values from the drop-down. For example, when you have a grid with Grid Filter Bar, if one of your columns is City and you want to see all the rows where City is 'Boston' for example and then you will have to drop the combo box at the top of the City column and select Boston. The grid will then display only those rows with Boston in the City column. Adding a Grid Filter Bar takes only two lines of code.

{% tabs %}
{% highlight c# %}
//Adds a Filter Bar to the DataBoundGrid.
//Adds a Filter Bar to the GridDataBoundGrid.
GridFilterBar filterBar = new Syncfusion.Windows.Forms.Grid.GridFilterBar();
filterBar.WireGrid(gridDataBoundGrid1);
{% endhighlight %}
Expand All @@ -77,13 +77,13 @@ filterBar.WireGrid(GridDataBoundGrid1)
{% endhighlight %}
{% endtabs %}

![Filtering-Grid-Data-Bound-Grid_img2](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img2.jpeg)
![Filtering_img2](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img2.jpeg)



## Filter By DisplayMember

Grid Data Bound Grid filters data records by value member of the columns. This default behavior can be customized in order to accomplish filtering by display member instead. This can be achieved by deriving custom filter from the GridFilterBar class wherein you can customize GetFilterFromRow method to replace the display strings in the filter with value strings.
GridDataBoundGrid filters data records by value member of the columns. This default behavior can be customized in order to accomplish filtering by display member instead. This can be achieved by deriving custom filter from the GridFilterBar class wherein you can customize GetFilterFromRow method to replace the display strings in the filter with value strings.

Filter By DisplayMember feature performs this sort of customization and lets you filter grid data by display member instead of value member.

Expand All @@ -100,7 +100,7 @@ filterBar.WireGrid(gridDataBoundGrid1)
{% endhighlight %}
{% endtabs %}

![Filtering-Grid-Data-Bound-Grid_img3](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img3.jpeg)
![Filtering_img3](Filtering-Grid-Data-Bound-Grid_images/Filtering-Grid-Data-Bound-Grid_img3.jpeg)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Very often a table will have a column that displays an ID key defined in another

Essential Grid will handle this work for you and it can be done through the designer. For the example discussed below, we use code to handle most of the steps.

In the designer, drag two of the DataBound Grids onto a form. Use one grid to show the foreign key combobox and the other to show the raw data for the primary table. Once the grids are in place, the code, which is given below will create the tables for this sample and then the code in the Form_Load will hook up the foreign key combobox. In our sample, we have set the combobox button to display only the current row.
In the designer, drag two of the GridDataBoundGrid's onto a form. Use one grid to show the foreign key combobox and the other to show the raw data for the primary table. Once the grids are in place, the code, which is given below will create the tables for this sample and then the code in the Form_Load will hook up the foreign key combobox. In our sample, we have set the combobox button to display only the current row.

{% tabs %}
{% highlight c# %}
Expand Down
28 changes: 14 additions & 14 deletions WindowsForms/Classic/DataBoundGrid/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Getting Started with Windows Forms GridDataBoundGrid Control

This section will provide step-by-step procedure to create Grid DataBound Grid through designer and through programmatic approach in a .NET application.
This section will provide step-by-step procedure to create GridDataBoundGrid through designer and through programmatic approach in a .NET application.

## Assembly Deployment

Expand All @@ -19,11 +19,11 @@ Refer [control dependencies](https://help.syncfusion.com/windowsforms/control-de

### Through Designer

In this lesson, you will learn how to use Forms Designer to create an Essential DataBound Grid. You can rely on the designer to generate all the codes necessary except for two lines: one that fills the ADO.NET adapter and one that updates the database when you are done.
In this lesson, you will learn how to use Forms Designer to create an Essential GridDataBoundGrid. You can rely on the designer to generate all the codes necessary except for two lines: one that fills the ADO.NET adapter and one that updates the database when you are done.

#### Basic DataBound Grid
#### Basic GridDataBoundGrid

In this part, you will learn how to use the designer to place DataBound Grid on a form.
In this part, you will learn how to use the designer to place GridDataBoundGrid on a form.

1. In Visual Studio .NET, use the File -> Menu option to create a new Windows Application project, naming it DBGridTutorial.

Expand Down Expand Up @@ -85,7 +85,7 @@ Click Next to confirm the Query you selected.

Click Finish. Your design surface will look similar to this.

![Windows Forms Getting-Started Image8](Getting-Started_images/Getting-Started_img8.jpeg)
![Getting-Started Image8](Getting-Started_images/Getting-Started_img8.jpeg)



Expand All @@ -99,15 +99,15 @@ Next you will need to generate a dataset from the SQLDataAdapter. Right-click sq

Press OK to add DataSet11 object next to sqlConnection1 under the design surface.

From the toolbox, drag Grid Data Bound Grid control to your form. Size and position it and add a button labeled Update to your form.
From the toolbox, drag GridDataBoundGrid control to your form. Size and position it and add a button labeled Update to your form.

![Windows Forms Getting-Started Image10](Getting-Started_images/Getting-Started_img10.jpeg)
![Getting-Started Image10](Getting-Started_images/Getting-Started_img10.jpeg)





Click DataBound Grid to display its properties in PropertyGrid. Set these properties.
Click GridDataBoundGrid to display its properties in PropertyGrid. Set these properties.



Expand Down Expand Up @@ -153,9 +153,9 @@ Now when you click Update button, it will post the changes made back to your dat

#### Applying special column formats

GridBoundColumn collection property of DataBound Grid is used to set column properties. This collection will let you control columns displayed and their order. For each column that you want displayed, add a Grid Bound Column. In this Grid Bound Column, you must set MappingName property; the other properties such as HeaderText and Style are optional. Under the Style property, you will have access to normal GridStyleInfo properties that you can apply to this column such as BackColor, CellType and Font.
GridBoundColumn collection property of GridDataBoundGrid is used to set column properties. This collection will let you control columns displayed and their order. For each column that you want displayed, add a Grid Bound Column. In this Grid Bound Column, you must set MappingName property; the other properties such as HeaderText and Style are optional. Under the Style property, you will have access to normal GridStyleInfo properties that you can apply to this column such as BackColor, CellType and Font.

![Windows Forms Getting-Started Image11](Getting-Started_images/Getting-Started_img11.jpeg)
![Getting-Started Image11](Getting-Started_images/Getting-Started_img11.jpeg)



Expand All @@ -167,15 +167,15 @@ GridBoundColumn collection property of DataBound Grid is used to set column prop

Click Add button to add a grid bound column, and then set MappingName property of that grid bound column to _ProductName_.

![Windows Forms Getting-Started Image12](Getting-Started_images/Getting-Started_img12.jpeg)
![Getting-Started Image12](Getting-Started_images/Getting-Started_img12.jpeg)





Select StyleInfo property and set BackColor for the column as shown in the following screen shot.

![Windows Forms Getting-Started Image13](Getting-Started_images/Getting-Started_img13.jpeg)
![Getting-Started Image13](Getting-Started_images/Getting-Started_img13.jpeg)



Expand All @@ -187,7 +187,7 @@ GridBoundColumn collection property of DataBound Grid is used to set column prop



Compile and run the project to see formatted Grid Data Bound Grid. In the following screen shot, you will be able to see the grid with columns specified and in the order that you specified them. Notice that the 'UnitPrice' column shows the price in specified currency format.
Compile and run the project to see formatted GridDataBoundGrid. In the following screen shot, you will be able to see the grid with columns specified and in the order that you specified them. Notice that the 'UnitPrice' column shows the price in specified currency format.

![Getting-Started_img15](Getting-Started_images/Getting-Started_img15.jpeg)

Expand All @@ -197,7 +197,7 @@ Compile and run the project to see formatted Grid Data Bound Grid. In the follow

### Through Code

Here are some code samples that will create a DataTable and bind it a to Grid Data Bound Grid. Once you have a DataTable object populated you can use the GridDataBoundGrid.DataSource property to implement the binding.
Here are some code samples that will create a DataTable and bind it a to GridDataBoundGrid. Once you have a DataTable object populated you can use the GridDataBoundGrid.DataSource property to implement the binding.

{% tabs %}
{% highlight c# %}
Expand Down
Loading