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

RadTreelist -- Itemdatabound

3 Answers 359 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Sindu
Top achievements
Rank 1
Sindu asked on 07 Nov 2011, 09:09 AM

Hi,

I have iterate an item in the item databound .and set a link  to the particluar text using  the below code ..

 

 

if (e.Item is TreeListDataItem)

 

{

 

 

TreeListDataItem item = e.Item as TreeListDataItem;

 

item[

 

"Description"].Text = "<a href=\"#\">" + 0512 + "</a>";

 

int j = 0;

 

}

My problem is to  set hyper link for 0512 .I mean an underline is shown below the code 0512.
But blue colour is not appearing in the  0512 .hyperlinks shows blue colour text normally.
But here is not display 0512 in blue colour.how is it possible?

Thanks
Sindu


3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Nov 2011, 10:30 AM
Hello  Sindu,

You can set color to HyperLink by adding one CssClass.

C#:
protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
{
 if (e.Item is TreeListDataItem)
   {
      TreeListDataItem itm = e.Item as TreeListDataItem;
      itm["ColUniqueName"].Text = " <a href=\"#\">" + 0512 + "</a>";
      itm["ColUniqueName"].CssClass = "hypercolor";
   }
}

CSS:
<style type="text/css">
.hypercolor a
 {
   color:Blue! important;
 }
</style>

Thanks,
Princy.
0
praveen kumar
Top achievements
Rank 1
answered on 16 Feb 2016, 02:10 PM

Hi Princy,

I'm trying to set a downloadable file link to RadTreeList  using  TreeListHyperLinkColumn.For this i tried to access GetDataKeyValue  from following code but im unable access this data key name.

protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
        {
            if (e.Item is TreeListDataItem)
            {
                TreeListDataItem Item = e.Item as TreeListDataItem;
                var key = item.GetDataKeyValue("Parent").ToString(); // this part not giving GetDataItemKeyValue
            }
        }

  <telerik:RadTreeList ID="rtlTreeList" runat="server" OnNeedDataSource="rtlTreeList_NeedDataSource" ParentDataKeyNames="ParentID" 
                                                                    DataKeyNames="Parent" 
                                                                    AutoGenerateColumns="false" OnItemCreated="rtlAttachments_ItemCreated" OnItemDataBound="RadTreeList1_ItemDataBound">
                                                                    <Columns>
                                                                        
                                                                        <telerik:TreeListHyperLinkColumn ItemStyle-HorizontalAlign="Left" UniqueName="AttachmentFileName" HeaderStyle-Width="200px" 
                                                                            HeaderText="Attachment Name" DataTextField="AttachmentFileName">
                                                                             <ItemStyle HorizontalAlign="Left" CssClass="hyperlink"/>
                                                                        </telerik:TreeListHyperLinkColumn>
                                                                        
                                                                    </Columns>
                                                                    <ClientSettings>
                                                                        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="150"></Scrolling>
                                                                    </ClientSettings>
                                                                 
                                                                </telerik:RadTreeList>

Can you please suggest me a way to how to set download file link for RadTreeList.

 

0
Eyup
Telerik team
answered on 19 Feb 2016, 02:27 PM
Hello Praveen,

You can try using a Template column with a HyperLink, similar to the approach demonstrated in the web site provided here:
http://www.telerik.com/forums/open-report-link-using-unique-row-id#eupACGJdv0mBbLYsQEvMdQ

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeList
Asked by
Sindu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
praveen kumar
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or