How can you display an icon the gridview cell column which is dependent on the text value of an adjacent column. Also, I setup the asp template,item and image controls, do i need to set the imgURL value in the asp control side? here's my code below:
Code:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Image Img1 = (Image)e.Row.FindControl("Img1"); if (e.Row.Cells[7].Text == "Accepted") { Img1.ImageUrl = "~/images/check.ico"; Img1.Visible=true; } if (e.Row.Cells[4].Text =="unack") { Img1.ImageUrl = "~/images/warning.ico"; Img1.Visible = true; } }
Comment