I have a data grid, a new row is added when i click on button. the new row consists of dropdowns in each cell. the value of the next cell dropdown must be based on the first cell drop down and so on for the third cell. I am using a .net 2.0 windows application in c#
+1
A:
Use the CellEndEdit event and check what is selected when the first drop down is edited, then you can manipulate the others.
private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridViewFirstDropColumn.Index) //or your first column name.Index
{
//Maniputlate other drop down options (e.g. dataGridView[SecondColumnIndex, e.RowIndex].Items.Add(....);
}
}
ThePower
2009-07-22 06:52:21
A:
private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dataGridViewFirstDropColumn.Index)
//or your first column name.Index
{
//Maniputlate other drop down options (e.g. dataGridView[SecondColumnIndex,
e.RowIndex].Items.Add(....);
}
}
ss
2009-10-19 10:13:07