This is a migrated thread and some comments may be shown as answers.

[Solved] Is there a way to set the title attribute of a link created by a GridHyperlinkColumn?

2 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 20 May 2013, 06:49 PM
When using a GridHyperlink column bound to a datasource it automatically sets the title attribute of the generated link to the value of the innerHtml of the anchor element.  Is there a way to set the value to another value.

    <telerik:GridHyperLinkColumn DataNavigateUrlFormatString='~/{0}?Id={1}' DataNavigateUrlFields="Url,Item.Id" NavigateUrl="" HeaderText="Subject" DataTextField="Item.LinkText"  />


Which will render a link if item.LinkText is equal to "Hello World"

<a href="somelink?Id=1" title="Hello world">Hello World</a>

I don't want the title attribute to contain the link's text, but some other value instead including an empty string.
Is there some way to accomplish this?

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 20 May 2013, 07:19 PM
Hello,

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
    {  
      if(e.Item is GridDataItem)
        {
          GridDataItem dataItem = (GridDataItem)e.Item; 
          HyperLink lblVisitNo = dataItem["MyHyperLink"].Controls[0] as HyperLink ;   
  HyperLink.ToolTip = "your title text comes here";
        
    


<telerik:GridHyperLinkColumn DataNavigateUrlFormatString='~/{0}?Id={1}' DataNavigateUrlFields="Url,Item.Id" NavigateUrl="" HeaderText="Subject" DataTextField="Item.LinkText"  UniqueName="MyHyperLink" />

Thanks,
Jayesh Goyani
0
Michael
Top achievements
Rank 1
answered on 22 May 2013, 08:34 PM
Thank you!
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Michael
Top achievements
Rank 1
Share this question
or