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

Hyper Link On Header

1 Answer 54 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
shabbir mohammad
Top achievements
Rank 1
shabbir mohammad asked on 09 May 2011, 05:03 PM
Hi:

I have a treelist with some auto generated column. The header text of those columns needs to be hyperlinked so that user can click on that and navigate to some other page.

Currently I am generating 'href'  and assigning it to the header text to achieve this. The problem is that look and feel wise it does not appear as hyper link (i.e. blue color and underlined). When i move the cursor to it the ICON does change into 'hand' and I am able to successfully click and navigate to the destination url.

How can I force this header text to look and feel like actual hyperlink

Thanks
Shabbir

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 12 May 2011, 09:19 AM
Hello Shabbir,

Note that when sorting is enabled RadTreeList renders anchor elements that fire its sorting command in its header. That is why the appearance of the anchor elements in the header item is customized by the skin so that they look as basic text.

To workaround the above specifics you should create the anchor on the ItemCreated event like this:

protected void RadTreeList1_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListHeaderItem)
    {
        TreeListHeaderItem item = e.Item as TreeListHeaderItem;
        item["MyColumnUniqueName"].Controls.Clear();
        HyperLink link = new HyperLink();
        link.ID = "myLink";
        link.ForeColor = Color.FromArgb(0, 0, 240);
        link.Font.Underline = true;
        link.Text = "MyHeaderText";
        link.NavigateUrl="http://www.telerik.com";
        item["MyColumnUniqueName"].Controls.Add(link);
    }
}

I hope this helps.

Regards,
Martin
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.

Tags
TreeList
Asked by
shabbir mohammad
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or