I have a GridView with a CheckBox,
how do I set the Checkbox to true or false based on the DataItem Value....?
protected void gvName_RowDataBound(object sender, GridViewRowEventArgs e)
{
System.Data.DataRowView drv;
drv = (System.Data.DataRowView)e.Row.DataItem;
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkActive = (CheckBox)e.Row.FindControl("chkActive");
if (DataRow["Active"] == true) <--- Not sure if this is correct....
{
chkActive.Checked = true; <--- How do I find the DataItem and set control to true?
lblCreatedBy.Text = e.Row.DataItem["CreatedBy"]; <--- Same here need the DataItem...?
}
}
}