Cannot grok this...

2 posts, 0 answers
  1. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 06 Jan 2014 Link to this post

    Followup: Found this:

    which answered my question, and was able to resolve my issue.

    Sometimes, admittedly, I am not the brightest bulb on the planet, but for the life of me I just can't seem to get what I think is a rather simple TreeView to work.

    I have data from an SQL data source which is broken down into categories, i.e.

    ID              Text                    ParentId
    Header                                  Header
    Preamble                                Preamble
    Clauses                                 Clauses
                Administrative Fees     Clauses
                Prompt Delivery         Clauses
    Signature Block                         Signature Block
    Appendix                                Appendix
    Exhibit                                 Exhibit

    Basically, I want this to appear in a tree view with the "Id" Text being the primary (expandable) node (i.e. Clauses), and the "text" being the secondary node which will appear when the user expands the primary node.

    I've fiddled around w/ the various online examples, but either I get an error telling me "These columns don't currently have unique values" (if I leave the ParentId column blank when the Text column is blank) or I get nothing at all. I've tried duplicating the online example:

    <telerik:RadTreeView runat="server" ID="RadTreeView1" DataSourceID="SqlDataSource1"
    DataFieldID="id" DataFieldParentID="parentID" Skin="Vista" CheckBoxes="true">
            <telerik:RadTreeNodeBinding TextField="Text" />

    but without "seeing" the underlying data, I'm not sure how to structure my dataset to duplicate this functionality.

    Can someone provide a simple example of the proper TreeView syntax?

  2. Dimitar
    Dimitar avatar
    277 posts

    Posted 08 Jan 2014 Link to this post

    Hello Michael,

    In order to run the online demo example, you need to create an SQL database with a table named Links. The structure of the table may be seen in the attached SqlTableStructure.jpg file.
    The SqlTableContent.jpg file shows the sample data used in the demo.

    As the table content picture shows, the ID column should have unique values for each row.

    The ParentId column should have value NULL for all root level items.

    The Text column holds the text that is displayed in the TreeView.

    In the SampleSolutionStructure.jpg file attached, I have suggested a sample SQL Table content for your case.

    You may use the Binding to Hierarchical Data documentation article for further clarification of the SQL table structure and the resulting TreeView.

    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 the blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top