Gridview - Conditional Images
Posted
on ASP.NET 101
See other posts from ASP.NET 101
Published on Fri, 20 Jul 2007 17:17:12 GMT
Indexed on
2010/03/18
18:21 UTC
Read the original article
Hit count: 199
Then, inside the RowDataBound event of the Gridview, we put code, which first, checks and finds the Image control in that row, and then assigning a different JPG file to the ImageURL property of that image. One other thing here, you'll notice, is that when the criteria is matched, we set the Image control's Visible property to 'True'. That's because, one extra criteria is, that if the Units In Stock is larger than 80, we set the Image control's Visible property to 'False'.
Naturally, since we're checking one particular column in the Gridview for this data, we're using a Select Case statement.
© ASP.NET 101 or respective owner