To use DROPDOWNLIST in DataGrid to use
1. DataGrid's DataGrid_ItemDatabase (Object Sender, System.Web.ui.WebControls.DataGriditeMeventArgs E) event
ItemDatabase has occurred after the item is bound to the DataGrid control.
2. LISTTYPEITEM enumeration
Specify the type of item in the list control
Member Name Description AlternatingItem alternates (from zero-started even index) cells. It is data binding. An item currently in editing mode in the EditItem list control. It is data binding. Footer list control of the foot. It is not data binding. Header list control of the header. It is not data binding. Item list controls. It is data binding. Pager page navigation, display controls that are locked to different pages associated with the DataGrid control. It is not data binding. SelectEM list controls in the selection. It is data binding. Separator between the Separator list control. It is not data binding.
example:
ASPX page --- only gives the data in the DataGrid section
asp: datagrid> p>
.Cs file
Private void myDataGrid_itemdatabase (object sender, system.web.ui.webcontrols.dataGriditeMeventArgs E)
{
If (E.Item.itemType == ListItemType.editItem)? // If there is an error that appears to be an instance of an object to an object, most of the two missing or the ListItemType selection error.
{SQLCONNECTION CONN = New SqlConnection ("Database = TEST; UID = SA; PWD; Server = (local)");
SqlDataAdapter Da = New SqlDataAdapter ("Select * from users", conn;
DataSet DS = New DataSet ();
Da.fill (DS);
DropDownList Drop = (DropDownList) E.Item.FindControl ("Dropdown");
Drop.DataTextField = "ID";
Drop.DataValuefield = "cusname";
DROP.DATASOURCE = DS.TABLES [0] .defaultView;
Drop.DATABIND ();
}
}