Hai guys..
Please see this code...
DataGridViewColumn col26 = new DataGridViewColumn();
DataGridViewCell cel26= new DataGridViewTextBoxCell();
col26.CellTemplate = cel26;
col26.HeaderText = "TDS";
col26.Name = "TDS";
col26.Visible = true;
col26.Width = 40;
dgvEmployeeSalary.Columns.Add(col26);
{
foreach (DataGridViewRow row in dgvEmployeeSalary.Rows)
{
if (row.Cells["Employee ID"].Value != null)
{
row.Cells["TDS"].Value = 0;
}
}
}
while running ,TDS named column is added to dgvEmployeeSalary.
So here my problem is while iam trying to change the item in combobox TDS row generated for 2 times..it depends on how many times iam changing the item in combobox,the tds count will be incremented.. can any one help me
Thanks & Regards
divya
Loading

Posted Jul 9, 2012, 7:24 AM
if (dgvEmployeeSalary.Columns.Contains("TDS")) == false)
{
add the column into gridview
}
else
{
update the cell value.
}
I have not tested the above code.
divyaPosted Jul 9, 2012, 7:49 AM