Question about DataBinding with DataSet...

2 posts, 0 answers
  1. J
    J avatar
    143 posts
    Member since:
    Jun 2006

    Posted 04 Jun 2009 Link to this post

    I have the following RadTreeView set up like this:

    <telerik:RadTreeView ID="radtree" runat="server" Skin="Default">  
        <Nodes> 
            <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_1">  
                <Nodes> 
                    <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_2">  
                        <Nodes> 
                            <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_3">  
                                <Nodes> 
                                    <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_4">  
                                        <Nodes> 
                                            <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_5">  
                                                <Nodes> 
                                                    <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_6">  
                                                        <Nodes> 
                                                            <telerik:RadTreeNode runat="server" Expanded="True" Text="Level_7">  
                                                            </telerik:RadTreeNode> 
                                                        </Nodes> 
                                                    </telerik:RadTreeNode> 
                                                </Nodes> 
                                            </telerik:RadTreeNode> 
                                        </Nodes> 
                                    </telerik:RadTreeNode> 
                                </Nodes> 
                            </telerik:RadTreeNode> 
                        </Nodes> 
                    </telerik:RadTreeNode> 
                </Nodes> 
            </telerik:RadTreeNode> 
        </Nodes> 
        <CollapseAnimation Duration="100" Type="OutQuint" /> 
        <ExpandAnimation Duration="100" /> 
    </telerik:RadTreeView> 

    I also have the following DataSet set up like this:

    DataSet oDS1 = null;  
    DbCommand dbCom = db.GetStoredProcCommand("SQL Code");  
    oDS1 = db.ExecuteDataSet(dbCom);  
     
    oDS1.Relations.Add(new DataRelation("Table0ToTable1", oDS1.Tables[0].Columns[0], oDS1.Tables[1].Columns[3], false));  
    oDS1.Relations.Add(new DataRelation("Table1ToTable2", oDS1.Tables[1].Columns[0], oDS1.Tables[2].Columns[3], false));  
    oDS1.Relations.Add(new DataRelation("Table2ToTable3", oDS1.Tables[2].Columns[0], oDS1.Tables[3].Columns[3], false));  
                   

    If I wanna bind oDS1 to a RadTreeView like this:
    radTree.DataSource = oDS1;  
    radTree.DataBind(); 

    What event do I need to access to be able to say something like:
     'all rows in Table[3] need to add nodes at level_7'.

    Jason
  2. J
    J avatar
    143 posts
    Member since:
    Jun 2006

    Posted 08 Jun 2009 Link to this post

    Ok I have figured out my answer.  I followed this link that Simon provided and changed my stored procedure to return 1 table with parent-child mappings.  And the TreeView bounded it all correctly.

    As a side note, my RadTreeView had a width of 100% (my resolution is 1280 X 1024) and that made all the plus signs appear on the left where as the text was all centered.  I found that wrapping a div tag with the style of text-align:left made every thing left aligned.  Text and Plus signs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top