images dynamically set from Datatable setting?

3 posts, 0 answers
  1. Jonathan Hylton
    Jonathan Hylton avatar
    20 posts
    Member since:
    Sep 2009

    Posted 01 Apr 2010 Link to this post

    Hi there,

    When using the tree view I would like to set a node image depending on what I have specified in the datatabe. for intance I am doing the following:

    1. I load a datset datatable from an SQL database
    the columns in the Datatable are
    ID, ParentID, Name, SQL_Query, Type


    list is listed as follows with the binding:

    FillSqlDs(

    "TreeView_Reports", "Select * from SYSM_T_REPORT_TREE_VIEW ORDER BY NAME")

     

     

    Me.TV_Reports.DataSource = ds.Tables("TreeView_Reports")

     

     

    Me.TV_Reports.ValueMember = "ID"

     

     

    Me.TV_Reports.ParentIDMember = "ParentID"

     

     

    Me.TV_Reports.DisplayMember = "Name"

     

     

    Me.TV_Reports.DataMember = "SQL_Query"

     



    I would like to be able to set the image depending on the "Type". for instance I have 2 options here type = Folder or Type = Report. I want the node that corelates to "Folder" to display a folder image that i have in my images list (ImageID 0) and if Type = Report, then the node image should show that of a report Image (ImageID 1). 

    I also plan to have if I double click the folder, it will expand the node as it currently is, however if I double click the Report node it will spawn off a DataGridView in another form that I have loading into the RadDock MDI Container.

    any help you could offer would be greatly appreciated.

    Many thanks!

    Jonathan
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 07 Apr 2010 Link to this post

    Hi Jonathan Hylton,

    In regards to your first requrement, you need to traverse all RadTreeView nodes recursively and set the appropriate image depending on the data contained in the DataBoundItem.

    As to your second inquiry, you need to handle the NodeExpandedChanging event and cancel it depending the DataBoundItem data.

    I am attaching a sample project which demonstrates the approaches. If you have additional questions, feel free to contact me.

    Sincerely yours,
    Nikolay
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Mar 2011 Link to this post

    Hello Jonathan,

    Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out.
    For more information about this release, please refer to this blog post.

    All the best,
    Stefan
    the Telerik team
Back to Top