Vikas Ahlawat

Vikas Ahlawat

  • NA
  • 564
  • 809.3k

Problem in binding comboboxCell Data..

Jun 12 2012 2:16 AM

Hi I have a datagridview (winform) inside it I have a cell type( DataGridViewComboBoxCell ) i want to bind the value in this combox cell according to the previous cell value.

I have done the following coding for bind it I have tried this on RowEnter event but it fire again and again on click etc..

So i don't want to use this event. Can any one tell me the best event on which i can put my following code...

List<int> k = new List<int>();

            int value = Convert.ToInt32( dgvDisplayAvailRoom.Rows[e.RowIndex].Cells[4].Value);

            for (int i = 1; i <= value; i++)

            {

                k.Add(i);

            }

            DataGridViewComboBoxCell cmb = (DataGridViewComboBoxCell)dgvDisplayAvailRoom.Rows[e.RowIndex].Cells[5];

            cmb.DataSource = k;                                  

Answers (2)