# Getting Started with WinForms GridView

This article shows how you can start using **RadGridView**.

| RELATED VIDEOS                                                                                                                                                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [RadGridView for WinForms Webinar](https://www.telerik.com/videos/winforms/radgridview-for-winforms-webinar)<br>Lino Tadros from Falalel provides an in-depth overview of Telerik's RadGridView for WinForms (Runtime: 01:45:11) |

## Adding Telerik Assemblies Using NuGet

To use `RadGridView` when working with NuGet packages, install the `Telerik.UI.for.WinForms.AllControls` package. The [package target framework version may vary](https://www.telerik.com/products/winforms/documentation/visual-studio-integration/available-nugets).

If you don’t need all controls, you can instead install a more lightweight package targeting only RadGridView: **UI.for.WinForms.GridView**. This package has a dependency on **UI.for.WinForms.Common**, which will be automatically installed when adding the GridView NuGet.

Read more about NuGet installation in the [Install using NuGet Packages](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/install-using-nuget) article.

> tip With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/winforms/documentation/licensing/license-key).

## Adding Assembly References Manually

When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.WinControls**
* **Telerik.WinControls.GridView**
* **Telerik.WinControls.UI**
* **TelerikCommon**

The Telerik UI for WinForms assemblies can be installed by using one of the available [installation approaches](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/installing-on-your-computer).

## Defining the RadGridView

The following tutorial demonstrates how to create a hierarchical grid that presents two tables: *Product Category* and *Product Information*.

> caption Figure 1: The final result

![Telerik UI for WinForms RadGridView hierarchical grid showing product categories with expandable product information rows](https://www.telerik.com/products/winforms/documentation/assets/6f5dc74f750b7a282181af98120d84d3/grid-getting-started001.png)

### Setting up the Form

1. Create a new **Windows Forms Application** project.

2. Drop a **RadGridView** control on the form.

3. In the **Properties** window for **RadGridView**, set the `RadGridView.Dock` property to *Fill*.

### Connecting to Data

1. In the **Properties** window for **RadGridView**, locate the `DataSource` property drop-down.

2. Select **Add Project Data Source**. This step will open the **Data Source Configuration Wizard**.

3. On the **Choose a Data Source Type** page, select **Database** and click **Next**.

   ![Telerik UI for WinForms RadGridView Data Source Configuration Wizard showing the Choose a Data Source Type step with Database selected](https://www.telerik.com/products/winforms/documentation/assets/4a3dc4932713ade5f134b7817ef87659/grid-getting-started002.png)

4. On the **Choose a Database Model** page, select **Dataset**.

5. On the **Choose Your Data Connection** page, select **New Connection...**. This page displays the **Choose Data Source** dialog.

6. In the **Choose Data Source** dialog, select **Microsoft Access Data Base File**.

7. Click **Continue**.

8. In the **Add Connection** dialog, click the **Browse...** button. This step will display the **Select Microsoft Access Database File** dialog.

9. In the **Select Microsoft Access Database File** dialog, navigate to the Telerik UI for WinForms installation directory and locate the `Nwind.mdb` file within the `\Examples\QuickStart\Datasources` directory. Select `Nwind.mdb` and click **OK**.

10. Click **OK** again to close the **Add Connection** dialog.

11. On the  **Choose Your Data Connection** page, click **Next**. Visual Studio shows a dialog that asks if you want to copy the file to your project.

12. Click **Yes** to close the Visual Studio dialog.

13. On the **Save the Connection String to the Application Configuration File** page, click **Next**.

14. On the **Choose Your Database Objects** page, expand the `Categories` table.

15. Select the following columns in the `Categories` table: `CategoryID`, `CategoryName` and `Description`.

16. Expand the `Products` table and select the following columns: `ProductName`, `CategoryID`, `UnitsOnOrder` and `Discontinued`.

    ![Telerik UI for WinForms RadGridView Data Source Configuration Wizard showing the selected columns in the Categories and Products tables](https://www.telerik.com/products/winforms/documentation/assets/0ea1af4eac5f31df83984f16095fbf91/grid-getting-started003.png)

17. Click **Finish** to close the **Data Source Configuration Wizard**.

18. In the **Properties** window for **RadGridView**, select the `DataSource` property drop-down.

19. Locate the `NwindDataSet` data source.

20. Select `Categories` from the `NwindDataSet` data source. This step will create the `categoriesBindingSource` and `categoriesTableAdapter` components.

    ![Telerik UI for WinForms RadGridView Properties window showing the Categories table selected from the NwindDataSet data source](https://www.telerik.com/products/winforms/documentation/assets/cb214164b2d61419ef575015ea8b737b/grid-getting-started004.png)

21. Select the `DataSource` property drop-down for a second time.

22. Select `Products` from the `NwindDataSet` data source. This step will create the `productsBindingSource` and `productsTableAdapter` components.

23. Select the `DataSource` property drop-down for a third time.

24. Select `NwindDataSet`. This step will assign the entire data set to the grid.

    ![Telerik UI for WinForms RadGridView Properties window showing the NwindDataSet assigned as the grid data source](https://www.telerik.com/products/winforms/documentation/assets/a50fc00b827714dde2608ef7b6a71b0e/grid-getting-started005.png)

### Setting Properties

1. In the **Properties** window for **RadGridView**, select the `DataMember` property.

2. Select `Categories` from the drop-down list. This step will assign `Categories` as a top level table for the grid.

3. In the **Properties** window for **RadGridView**, select the `AutoGenerateHierarchy` property.

4. Select `True` from the drop-down list.

5. Click the **RadGridView** smart tag in the form.

6. Select **Open Property Builder** from the smart tag menu.

7. Select the `CategoryID` column in the navigation tree and clear the checkbox.

8. Click **OK** to close the **Property Builder**.

9. Press **F5** to run the application. Notice that the grid displays the product categories first. Each category has an icon that you can click to expand that category and show a child template with the corresponding products.

## See Also

* [Property Builder](https://www.telerik.com/products/winforms/documentation/controls/gridview/design-time-support/property-builder)

* [Smart tag](https://www.telerik.com/products/winforms/documentation/controls/gridview/design-time-support/smart-tag)

## Telerik UI for WinForms Learning Resources

* [Telerik UI for WinForms Gridview Component](https://www.telerik.com/products/winforms/gridview.aspx)
* [Getting Started with Telerik UI for WinForms Components](https://docs.telerik.com/devtools/winforms/getting-started/first-steps)
* [Telerik UI for WinForms Setup](https://docs.telerik.com/devtools/winforms/installation-and-upgrades/installing-on-your-computer)
* [Telerik UI for WinForms Converter](https://www.telerik.com/products/winforms/documentation/ai-coding-assistant/converter/converter)
* [Telerik UI for WinForms Visual Studio Templates](https://docs.telerik.com/devtools/winforms/visual-studio-integration/visual-studio-templates)
* [Deploy Telerik UI for WinForms Applications](https://docs.telerik.com/devtools/winforms/deployment-and-distribution/application-deployment)
* [Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/17/telerik-ui-for-winforms)
* [Telerik UI for WinForms License Agreement)](https://www.telerik.com/purchase/license-agreement/winforms-dlw-s)
