DataGridview:
Loading combo box in DataGridView.
Code:
private void LoadCapcityUtilizationReport()
{
try
{
int iClientId = 0;
DataTable
dtCapcity = clsCommon.oAdmin.dtGetCapcityUtilizationReport(dtpCapacityFromDate.Value,
iClientId);
if
(dtCapcity != null)
{
DataTable dtClient = clsCommon.oAdmin.GetActiveClientNames();
if
(dtClient != null)
{
DataRow dr = dtClient.NewRow();
dr["ClientId"] = "0";
dr["ClientName"] = "--Select--";
dtClient.Rows.InsertAt(dr, 0);
dgvColClient.DataPropertyName = "ClientName";
dgvColClient.HeaderText
= "Client";
dgvColClient.ValueMember = "ClientId";
dgvColClient.DisplayMember = "ClientName";
dgvColClient.DataSource
= dtClient.DefaultView;
dgvColClient.DefaultCellStyle.NullValue = dtClient.Rows[0]["ClientName"].ToString();
}
dGvCapacity.DataSource = dtCapcity.DefaultView;
dGvCapacity.Refresh();
}
}
catch
(Exception ex)
{
ExceptionHandler.HandleException(ex.ToString());
}
}