ASP.Net Gridview DropDownList Column
In ASP.Net combination of GridView DropDownList control provides the functionality to display the list of items in the DropDownList control placed inside the ItemTemplate of TemplateField column of GridView Data Bound Control. DropDownList control can display the collection of items in the form of drop down menu. User can choose one list item of DropDownList control to assign the value for a particular record in the database table. In this tutorial we will learn how to bind the data and set the SelectedValue property of the nested DropDownList control placed inside the TemplateField of GridViewControl.
You can see the live samples and examples of GridView from the following links:
In SQL Server Database, relational schema of relational tables is designed to normalize the stored data so that there should not be any redundancy in the stored data. Relational schema of SQL Database tables is also designed to get the related information of any particular record saved in different tables. As an example you can consider a database schema of e-commerce shopping website. While displaying the product order, information is retrieved from the different tables having relation with each other based on primary or foreign keys. For example, order table stores the information in the form of relational key values in the database.
A rough view of Order table schema: customerID, productID, Order_Status_Id.
Based on above entities customer details related to Order table can be retrieved from the customers table having relational key CustomerID. Product details can be retrieved from the product tables having relational key ProductID. Similarly order status name can be retrieved from the order status table using the relational key order_status_id.
In this tutorial about GridView Control of ASP.Net and DropDownList placed inside the GridView template field column we will use two relational tables of SQL Database: tbl_Orders and tbl_Order_Status. Second table is used to save the order status names such as pending, approved, confirmed and declined. tbl_orders is used to save the order id and order status id.
From the above relational database diagram you can see that both tables have order_status_id is common. tbl_orders will save only the corresponding id of order_status_name stored in the tbl_order_status table.
Continue to next tutorial: ASP.Net GridView Template DropDownList to learn how to set a gridivew containing dropdownlist column.