Hello,
I
have datagridview on my form having 2 combobox.
One for Country and
another for state.
I handle event for both combobox..
When i
click on country combobox then it's selected change commited event fire
and fill state. working properly...
But when i click on state
then also country column event fire and reload the state column.
Please
help me.......
private void
dgvContactDetail_EditingControlShowing(object sender,
DataGridViewEditingControlShowingEventArgs e)
{
switch (dgvContactDetail.CurrentCell.ColumnIndex)
{
case 1:
{
var cb = (ComboBox)e.Control;
cb.SelectionChangeCommitted -= new
EventHandler(countryComboBox_SelectionChangeCommitted);
cb.SelectionChangeCommitted += new
EventHandler(countryComboBox_SelectionChangeCommitted);
}
break;
case 2:
{
var cb =
(ComboBox)e.Control;
cb.SelectionChangeCommitted -= new
EventHandler(stateComboBox_SelectionChangeCommitted);
cb.SelectionChangeCommitted += new
EventHandler(stateComboBox_SelectionChangeCommitted);
}
break;
default:
break;
}
}
private
void countryComboBox_SelectionChangeCommitted(object sender, EventArgs
e)
{
// Fill State Combo
}
private
void stateComboBox_SelectionChangeCommitted(object sender, EventArgs e)
{
// Fill City
}
Thanks,
Asif
Huddani
http://asifhuddani.wordpress.com
Loading
Amit ChoudharyPosted Apr 19, 2010, 11:13 AM
i did'nt find any event for selected index change of your combobox inside the Datagrid... you should post the code you have added inside the event of combobox and may be you have called the gridbind method inside that event..
do post the code for that or check for the case i have mentioned.
Please mark as answer if it helps.