Treview drag and drop hierarchy

2 posts, 0 answers
  1. Joey
    Joey avatar
    3 posts
    Member since:
    May 2008

    Posted 21 Sep 2008 Link to this post

    Hi,

    I am fairly new to ASP.NET.  I am having a bit of difficulty trying to use the treeview drag and drop as a means of ordering pages.

    The use case is to allow the user to have the ability drag a node and move it to a new location in the same control and then save to the database.

    My database structure is the same as the rad menu example...

    Table: tblPages
    Column: PageID
    Column: ParentID
    Column: PageTitle

    Here is my control setup.

    <telerik:RadTreeView ID="RadTreeView2" runat="server" EnableDragAndDrop="True" DataFieldID="PageID"
            DataFieldParentID="ParentID" DataSourceID="SqlDataSource1" DataTextField="PageTitle"
            Skin="Web20">
            <CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
            <ExpandAnimation Duration="100"></ExpandAnimation>
        </telerik:RadTreeView>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT * FROM [tblPages]"></asp:SqlDataSource>

    I have nothing in my code behind. I tried using the examples but can't get anything to work without errors in VS 2008, complaining about the code.

    Any help in a direction or pointing to a sample that is related to my goal  would be great. I have lost what hair I had left from trying to work with the demos. : (

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 22 Sep 2008 Link to this post

    Hi Joey,

    How exactly did you try to use the examples. Opening the web site compiles fine without issues using Visual Studio. If you want to extract an example in a separate project you need to take a few additional steps to remove the code related with our quick start framework (user controls, images, etc).
    1. Delete the following register directives from the ASPX
      <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
      <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
      <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
      <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    2. Remove the following user controls from the ASPX:
      <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag>
      <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#"></qsf:Header>
       <qsf:Footer ID="Footer1" runat="server"></qsf:Footer>
    3. Go in code behind and change the base type of the page from XhtmlPage to System.Web.UI.Page
    4. Remove the reference to the Telerik.QuickStart namespace:
      using Telerik.QuickStart;
    I suggest you check our drag and drop example.

    I hope this helps,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top