fill combobox value in datagridview based on other combobox in datagridview
<p>I m creating Web Application..in C# I have One Data grid view In that i Have 2 Combo box i m trying 2 bind second combo box based on first combo-box. in First Combo-box I have value Shirt,T shirt so i want if shirt is selected than second combo-box should have value Slim,Regular..and if T shirt Is selected than second Combo-box should have V neck and rounded color. i have different table for thirst and shirt type...</p>

<p>I work fine for first time but when i goes on second row and change the combo box value than it will also change value of second combo box value of previous row as well ..</p>

<p>Where i need to change to prevent change in upper row</p>

<p>i have following code</p>

<pre><code>private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {

        if (dataGridView1.CurrentCell.ColumnIndex == 0)
        {
            ComboBox cbx = e.Control as ComboBox;
            cbx.SelectionChangeCommitted -= new EventHandler(cbx_SelectionChangeCommitted);
            cbx.SelectionChangeCommitted += new EventHandler(cbx_SelectionChangeCommitted);

        }
    }


private void cbx_SelectionChangeCommitted(object sender, EventArgs e)
    {
        int selectedIndex = ((ComboBox)sender).SelectedIndex;
        if (selectedIndex == 1) //this condition is true if i have selected shirt from combobox1
        {
                ShirtType();  
        }

        if (selectedIndex == 2)
        {
                Tshirtype();  
        }
    }


void ShirtType()
    {
        try
        {
            string str;
            str = "select ShirtType_name,ShirtType_Id from ShirtType_master";
            ds = new DataSet();
            ds = cn.readdata(str);
            Type.DataSource = ds.Tables[0];//Type is Combobox name of Second Combobox
            Type.DisplayMember = ds.Tables[0].Columns[0].ToString(); ;
            Type.ValueMember = ds.Tables[0].Columns[1].ToString(); ;
        }
        catch (Exception ee)
        {
        }
    }

void Tshirtype()
    {
        try
        {
            string str;
            str = "select TShirtType_name,TshirtType_Id from TshirtType_Master";
            ds = new DataSet();
            ds = cn.readdata(str);
            Type.DataSource = ds.Tables[0];
            Type.DisplayMember = ds.Tables[0].Columns[0].ToString(); ;
            Type.ValueMember = ds.Tables[0].Columns[1].ToString(); ;


        }
</code></pre>
