Sathya Narayan

Sathya Narayan

  • NA
  • 155
  • 63.7k

To bind the values from datagridview to radiobutton

Feb 12 2014 3:57 AM
hi ,

I need to bind the datagridview values to radiobutton,its not fetching the values from datagridview.
This is my code

private void DataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = new DataGridViewRow();
            row = DataGridView3.Rows[e.RowIndex];
           
            // Will put the value of the first column of the selected row into the textbox
            label14.Text = row.Cells[0].Value.ToString();
            txtsn.Text = row.Cells[1].Value.ToString();
            txtsem.Text = row.Cells[2].Value.ToString();
            cbosub.Text = row.Cells[3].Value.ToString();
             rdbtn_present.Checked = row.Cells[4].Text; 
             rdbtn_absent.Checked = row.Cells[4].Text; 
            if (row.Cells[4].Text.Equals("Present"))
                rdbtn_present.Checked = true;
            else
                rdbtn_present.Checked = false;
            if (row.Cells[4].Text.Equals("Absent"))
                rdbtn_absent.Checked = true;
            else
                rdbtn_absent.Checked = false; 
            Btn_Save.Enabled = false;
            Btn_Modify.Enabled = true;
            label14.Text = "";
            label6.Text = "";
            label5.Text = "";
            label11.Text = ""; 
        }
 can any one help me???

Answers (2)