To nest the DropDownList control to GridView control is very helpful to show the data by selectable criteria. The DropDownList control can be easily nested to the GridView control. In this sample, each DropDownList is binded for different data. For instance, we can use GridView to show each category data in Northwind database, while we can use DropDownList to show all products under the selected category in each line. We will show you this tutorial by ASP.NET 2.0 and C#.

To nest the DropDownList control to GridView control is very helpful to show the data by selectable criteria. The DropDownList control can be easily nested to the GridView control. In this sample, each DropDownList is binded for different content. For instance, we can use GridView to show each category data in northwind database, and we can use DropDownList to show all products under the selected category in each line.

First, to connect to the sample database, you will need to import the System.Data.SqlClient namespace.

Binding DropDownList to GridView.

The front GridviewNestingDropdowlist.aspx page looks something like this:

The flow for the code behind page is as follows.

Download Source Files