How to check the status (True/False) in a grid view on rowdatabound event?
- by NayeemKhan
Hi all, I have a table with three columns (ProdID,ProdName,Status). I m fetching that into a dataSet and binding that to my gridview. I have a very basic and simple rowdatabound event like this :
protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text == "False")
{
e.Row.BackColor = System.Drawing.Color.PaleVioletRed;
}
}
}
But when i see my 3rd column (Status), it is converted to a checkbox, may be becz its containing only 'True' or 'False'. Also in my if condition :
if (e.Row.Cells[3].Text == "False")
the text value is showing this :
""
Can anybody suggest me, how can i compare my status against True or False in my if condition.