Monday, September 20, 2010

Red Green Button in gridview (true, False)

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// take the data in to dataset called ds
ImageButton ibtnSt = (ImageButton)e.Row.FindControl("ImageButton1");
int temp= int.Parse(ibtnSt.CommandArgument);
if (ds.tables[0].rows[0][3]== true)
{
ibtnSt.ImageUrl = @"image" + @"/iconGreen.gif";
}
else
{
ibtnSt.ImageUrl = @"image" + @"/iconRed.gif";
}
}
}

0 comments:

Post a Comment