I have GridView
filling correctly, however I need to get the value of column 5, which is of type BIT
in database (SQL Server).
In every way I try, it informs error, I already tried to pass to a variable of type bool
, pass to a CheckBox
and still the error persists.
Follow the code:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
txtid.Text = (GridView1.SelectedRow.Cells[0].Text);
conta = (GridView1.SelectedRow.Cells[2].Text);
bool Insertar = ((CheckBox)(GridView1.SelectedRow.Cells[5].FindControl("quitado"))).Checked;
if (Insertar == true)
{
cbquitado.Checked = true;
}
}
I've tried it too:
bool quitado = Convert.ToBoolean(GridView1.SelectedRow.Cells[5].Text);
How can I get the value of the column by selecting the line in GridView
?