Binding TreeView ImageURL with ObjectDataSource, it's possible?

3 posts, 0 answers
  1. Allin
    Allin avatar
    33 posts
    Member since:
    Jun 2012

    Posted 28 Mar 2013 Link to this post


    I tried to bind ImageUrl property with ObjectDataSource without success. I look all demo and exemple for this work and i can't find how to bind this property.

    My treeView display the text and build good structure, mais i can't set ImageUrl from my object.

    I tried this in the markup 
    <telerik:RadTreeView ID="rtvNavigation" runat="server"
    and onNodeDataBound event, i can't set this imageURL because the ID is always empty.

    Thank you for help!

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    1968 posts

    Posted 02 Apr 2013 Link to this post


    I would recommend to use the RadTreeView NodeDataBound server-side event in order to achieve such scenario.
    //code behind

    protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
           //in this specific case the TypeName="SiteDataItem" and the property that holds ImageUrl value is ImageUrl
           SiteDataItem dataItem = (SiteDataItem)e.Node.DataItem;
           e.Node.ImageUrl = dataItem.ImageUrl;

    Please find attached a sample project that implements the described scenario. Please keep in mind that the custom class SiteDataItem implementation is located in the App_Code folder.

    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Allin
    Allin avatar
    33 posts
    Member since:
    Jun 2012

    Posted 04 Apr 2013 Link to this post

    Thank you Boyan, that's work fine!

Back to Top