Can anyone help please?
Thanks a lot,
Marta
12 Answers, 1 is accepted

You can access the hyperlink for the hyperlink column and set its ImageUrl property to the required image url as shown below:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
HyperLink hyplnk = (HyperLink)item["HyperLinkColumnUniqueName"].Controls[0]; |
hyplnk.ImageUrl = "~/image.gif"; |
} |
} |
Thanks
Princy.

Hi,
Thanks for your reply. I tried what you suggested, but I can't get the image to appear, I don't know why...
My GridHyperLinkColumn is as follows:
<telerik:GridHyperLinkColumn
DataNavigateUrlFormatString="/lms_bd/FichaConteudo.aspx?conteudo={0}" Target="_self" DataTextFormatString="my edit page" DataNavigateUrlFields="IDConteudo" UniqueName="VerFicha" HeaderText="Ver Ficha" Text="Ver" />
The name of the radgrid is Conteudos.
The code in my .cs file is:
protected void Conteudos_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
HyperLink hyplnk = (HyperLink)item["VerFicha"].Controls[0];
hyplnk.ImageUrl = "~/imagens/bt_arvore_ficheiro.gif";
}
}
Any suggestions to solve this problem?
Thanks:)

if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
HyperLink hyplnk = (HyperLink)item["Editar"].Controls[0];
hyplnk.ImageUrl =
"~/imagens/bt_editar.gif";
}
Before it wasn't working because of an error on my page.
thanks!


Here is the code in VB:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) |
If TypeOf e.Item Is GridDataItem Then |
Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) |
Dim hyplnk As HyperLink = DirectCast(item("HyperLinkColumnUniqueName").Controls(0), HyperLink) |
hyplnk.ImageUrl = "~/image.gif" |
End If |
End Sub |
Thanks
Shinu

I think its a little ridiculous to have to set the hyperlinks ImageURL on the RowDataBound event. Can a request be made to the Dev team to add a property to the GridHyperLinkColumn class in the RadGrid control to include a property for something like "HyperLinkImageURL" and if the field has a value, override the Text field so the Image is displayed instead of the text (or just display both)... ??
I guess its not that big of a deal to set the image on RowDataBound, but having a "HyperLinkImageURL" makes reading the source easier if a property existed.
Greetings,
Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Greetings,
Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Hello Neil,
For such cases you can use a TemplateColumn and add controls inside according to your concrete requirements. For example, you can add an asp:HyperLink and data bind its CssClass or directly information in its style attribute. Or, you can add an asp:Image inside and bind its ImageUrl.
Regards,
Progress Telerik
