RadTreeView LinqDatasource binding not working

4 posts, 0 answers
  1. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 26 Jan 2010 Link to this post

    My code as I see it is exactly the same as the demo explaining this (I think).
    Hope someone can find out why mt Radtree is not displaying any data.

    This is my code:

        <telerik:RadTreeView ID="RadTreeView1" runat="server" Width="100%" Height="250px" 
              DataFieldID="code" DataFieldParentID="parentcode" 
            DataTextField="absencereasonname" DataValueField="code"   
            DataSourceID="LinqDataSource1">  
            <DataBindings> 
                <telerik:RadTreeNodeBinding Depth="0" Expanded="true" /> 
            </DataBindings> 
        </telerik:RadTreeView> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"    
            ContextTypeName="Orbit.Benjamin.DB.PartyDataContext"   
            TableName="AbsenceReasons"   
            Select="new (code, absencereasonname, parentcode)">  
        </asp:LinqDataSource> 
     

    and this is my DB table structure

        [code] [nvarchar](10) NOT NULL,  
        [absencereasonname] [nvarchar](100) NULL,  
        [parentcode] [nvarchar](10) NULL, 

    I am calling DataBind() on PageLoad but my tree returns with 0 nodes.
    This looks simple enough but I can not find out what I am doing wrong.

    reg.
    Axel
  2. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 26 Jan 2010 Link to this post

    Hi again,

    Also tried to do it this way (in PageLoad) without any luck. Even tried a different table this time.
    This simple code is not working at my end. What can be wrong?

                    PageManagementDataContext db = new PageManagementDataContext();  
                    List<WebPage> x = db.WebPages.ToList();  
                    RadTreeView1.DataTextField = "pagename";  
                    RadTreeView1.DataFieldID = "id";  
                    RadTreeView1.DataFieldParentID = "parentpageid";  
                    RadTreeView1.DataSource = x;  
                    RadTreeView1.DataBind();  
     

    (Manually populating the nodes works but if databinding can be done then that's the way I sould do it.
  3. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 28 Jan 2010 Link to this post

    Hi AxelGunn,

    I already replied to the ticket of yours.

    Please download a sample project from here. Hope you will find it useful.
    Greetings,
    Veskoni
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 28 Jan 2010 Link to this post

    Thanks. 
    Ending this one - will use the ticked for replies
Back to Top