Posted 03 Sep 2013 Link to this post
<
telerik:GridTemplateColumn
HeaderText
=
"OrderDate"
UniqueName
>
ItemTemplate
asp:Label
ID
"Label1"
runat
"server"
Text='<%# Eval("OrderDate")%>'></
asp:Image
"Image1"
ImageUrl
"~/RadGrid6/image.jpg"
Visible
"false"
/>
</
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
GridDataItem item = (GridDataItem)e.Item;
Label lbl = (Label)item.FindControl(
);
//Access the label in template column
string
date = lbl.Text;
//Your Condition to show the image
Image img = (Image)item.FindControl(
//Access the image in template column
img.Visible =
true
;
//Set visibility
}
Posted 05 Jul 2017 in reply to Princy Link to this post
I got the next error:
protected void grvHTE_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; Label lbl = (Label)item.FindControl("INFGACTIVOLabel");//Access the label in template column string active = lbl.Text; //Your Condition to show the image if (active == "1") { Image imagen = (Image)item.FindControl("Image1"); } } }
Error4 Cannot convert type 'System.Web.UI.Control' to 'Image'C:\Users\JSSJZP0524\Documents\Visual Studio 2013\WebSites\TelerikMAPS\DCO\SWS.aspx.cs13433TelerikMAPS