Following is grid view code for aspx page.



Width="100%" OnRowDataBound="gv_RowDataBound">


































































Following code evaluates each row of grid:

protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

Label lblStudentName = ((Label)e.Row.FindControl("lblStudentName"));
Image imgControl = ((Image)e.Row.FindControl("imgControl"));

lblStudentName.Text = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "StudentName"));
imgControl.ImageUrl = (Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "Present")) ? "Images/Checkmark.png" : "Images/Cross.png");
}
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/P3QQaXrJRl8/14541