I have a bit (black). I want to display its status in gridview, as if its true, the line displayed "Yes", otherwise the line "No", this is my code, but the result is wrong, because my code displays all the lines "Yes", if one value is true I want to display each line status
protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataTable dt = GetData(); for (int i = 0; i < dt.Rows.Count; i++) { Boolean bitBlack = Convert.ToBoolean(dt.Rows[i]["Black"]); if (bitBlack) { e.Row.Cells[7].Text = ("Yes"); } else { e.Row.Cells[7].Text = ("No"); } } } }
source share