OnClick not fired with Entity/LINQ DataSource

3 posts, 0 answers
  1. Lone
    Lone avatar
    6 posts
    Member since:
    Nov 2009

    Posted 23 Feb 2011 Link to this post

    Hey Telerik

    I have big problems using my Entity datasource with my TreeView.
    Everything is shown just fine, but can't get OnNodeClick event to fire.

    Please advise !!


    <telerik:RadTreeView runat="Server" ID="BookGroupTreeView" DataFieldID="Hierarchy_id"
        DataFieldParentID="Parent_Hierarchy_id" DataTextField="Name" DataValueField="Hierarchy_id"
        Skin="Vista" EnableTheming="True" RegisterWithScriptManager="true" OnNodeClick="BookGroupTreeView_NodeClick">

    protected void Page_Load(object sender, EventArgs e)
         List<DB.Hierarchy> bookHierarchy = new List<DB.Hierarchy>();
         bookHierarchy = DB.HierarchyService.HierarchyFullListFromParentPath("Root");
         BookGroupTreeView.DataSource = bookHierarchy;
  2. Kate
    Kate avatar
    1898 posts

    Posted 25 Feb 2011 Link to this post

    Hi Jan Hjørdie,

    Here is a sample page with two treeview controls - one linked to an entity datasource, the other one linked to a linq datasource. I attached an event handler on both trees and it behaves as it should - the event is fired.

    Best wishes,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Lone
    Lone avatar
    6 posts
    Member since:
    Nov 2009

    Posted 25 Feb 2011 Link to this post

    Hey Kate
    Thanks for your example.
    My data is not presentet the way you suggest. I have my data layer in a seperate project. My DB project, where I ex. have a Hierachy Service, that return a List<Hierachy>.

    So what should I do then ? Do I need the LinqDataSource ? I just thought setting the treeview datasource to bookHierachy was enough ?
    My treeview is rendered just fine, it's just my OnNodeClick event that don't fire ?

     <asp:LinqDataSource ID="LinqDataSource1" runat="server" EntityTypeName="" ContextTypeName="DataClassesDataContext"



    List<DB.Hierarchy> bookHierarchy = new List<DB.Hierarchy>();

    bookHierarchy = DB.HierarchyService.HierarchyFullListFromParentPath("Emner");

Back to Top