raviteja
Member
- Joined
- Oct 15, 2019
- Messages
- 8
- Programming Experience
- Beginner
i tried in this way to populate datagridview based on combobox selection,but it is not working,can anyone help me
C#:
if (metroComboBox1.Text == "Header")
{
DataRow[] rows = Common._dataSet.Tables["oSelectedFields"].Select("Category='H'");
foreach (DataRow r in rows)
{
foreach (DataGridViewRow dr in dtgSelectedFieldList.Rows)
{
DataRow gv2dr = dt.NewRow();
gv2dr["Description"] = dr.Cells["Description"].Value.ToString();
gv2dr["FieldType"] = dr.Cells["FieldType"].Value.ToString();
gv2dr["FieldID"] = dr.Cells["FieldID"].Value.ToString();
//Add slected rows in second datagridview
dt.Rows.Add(gv2dr);
}
}
dtgSelectedFieldList.DataSource = dt;