This is a migrated thread and some comments may be shown as answers.

[Solved] Rad Tree conversion from 2007.2.1107.0 to 2008.1.515.20[Telerik.Web.UI.dll] versions

11 Answers 165 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Srinath
Top achievements
Rank 1
Srinath asked on 29 May 2008, 10:33 AM
Hi,

SUB: Rad Tree conversion from 2007.2.1107.0 to 2008.1.515.20[Telerik.Web.UI.dll] versions

I have been using Rad Tree version 2007.2.1107.0 till now, But now I got to upgrade to 2008.1.515.20[Telerik.Web.UI.dll] version.
Below is the code that I am using for 2007 version and it is working properly.

Could you pls help me out in converting the following properties of 2007 to 2008 version 

                             AllowNodeEditing="false"
                            BeforeClientContextClick="ContextMenuClick"
                            SingleExpandPath="True"
                            AfterClientMove="ClientMove"
                            BeforeClientDrop="DropTest"
                            MultipleSelect="false"
                            CheckBoxes="false"
                            OnNodeDrop="HandleDrop"
                            DragAndDrop="True"
                            DragAndDropBetweenNodes="True"
                            AutoPostBack="True"
                            OnNodeClick="TreeNode_NodeClick"
                            ID="MenuTree"


I need all these properties in new version too like node clicked, Drag and Drop
I know that I need to use RadCodeBlock for Drag and Drop Javascript functions.

Pls help me out in this regard. It is bit urgent.
Kindly try to explain in detail.

Thanks,
--Srinath

11 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 29 May 2008, 10:53 AM
Hello Srinath,

For details on the matter please refer to the control's documentation under section Controls --> RadTreeView --Overview --> Migrating from RadTreeView for ASP.NET to ASP.NET AJAX.

All the best,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Srinath
Top achievements
Rank 1
answered on 30 May 2008, 07:00 AM
Paul,

I have changed accordingly, but still it is not allowing me to rise Node click and Drag and drop functionalities :(.

My code looks like this,

 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
            var grid = null;
           function IsMouseOverGrid(events)
            {
                var target = (document.all) ? events.srcElement : events.target;
                parentNode = target;
                while (parentNode != null)
                {                   
                    if (parentNode.id == "")
                    {
                        return parentNode;
                    }
                    parentNode = parentNode.parentNode;
                }
               
                return null;
            }

            function DropTest(source, dest, events)
            {
                var target = (document.all) ? events.srcElement : events.target;   
                if (target.tagName == "INPUT")
                {
                    target.style.cursor = "default";
                    target.value = source.Text;       
                    return false;
                }   
               
                if (grid != null)
                {
                    source.TreeView.HtmlElementID = "Grid";       
                    grid.style.cursor = "default";
                    grid = null;
                    return true;
                }
               
                if (dest != null)
                {       
                    return true;
                }       
               
                return false;
            }

            function ClientMove(events)
            {   
                var target = (document.all) ? events.srcElement : events.target;   
                if (target.tagName == "INPUT")
                {       
                    target.style.cursor = "hand";
                }
               
                var dummy = IsMouseOverGrid(events)
                if (dummy != null)
                {
                    grid = dummy;   
                    grid.style.cursor = "hand";
                }
                else
                {
                    grid = null;
                }
            }

            function ContextMenuClick(node, itemText)
            {
                if (itemText == "Disable")
                {
                    node.Disable();
                    return false;
                }
                if (itemText == "Enable All")
                {
                    for (var i=0; i<node.TreeView.AllNodes.length; i++)
                    {
                        node.TreeView.AllNodes[i].Enable();
                    }
                }
                if (itemText == "Edit")
                {       
                    node.StartEdit();
                }
               
                return true;
            }

     </script>
    </telerik:RadCodeBlock>


<td>
                    <PortalControls:TreeViewControl
                            AllowNodeEditing="false"
                            OnClientContextMenuItemClicking="ContextMenuClick"
                             SingleExpandPath="True"
                            OnClientNodeDragging="ClientMove"
                            OnClientNodeDropping="DropTest"
                            MultipleSelect="false"
                            CheckBoxes="false" 
                            OnNodeDrop ="MenuTree_NodeDrop"
                            EnableDragAndDrop = "true"
                            EnableDragAndDropBetweenNodes = "true"
                            OnNodeClick="MenuTree_NodeClick"
                            ID="MenuTree"
                            runat="server">
                        </PortalControls:TreeViewControl>
                </td>

Could please look in to this.

It is throwing an error "tagname is null or undefined" when i try to drag it.

Thanks,
--Srinath

0
Atanas Korchev
Telerik team
answered on 30 May 2008, 07:32 AM
Hi Srinath,

You don't seem to have modified your code according to the migration guidelines. Please check this
 online example which demonstrates drag and drop from RadTreeView to RadGrid.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Srinath
Top achievements
Rank 1
answered on 30 May 2008, 09:32 AM
Hi Albert,

I have modified my code according to the Eg u have given. But

Drag drops and node clicks server side events are not firing.

Pls suggest.

Thanks,
--Srinath
0
Atanas Korchev
Telerik team
answered on 30 May 2008, 10:06 AM
Hi Srinath,

Server side events may not fire if you have not subscribed successfully to them. Please verify this is not the case. Also check for any JavaScript errors in your page - they can prevent postbacks as well.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Srinath
Top achievements
Rank 1
answered on 30 May 2008, 10:36 AM
Albert,

I have just copied the example that you have given. Even in that OnNodeDrop="RadTreeView1_HandleDrop" is not working.

If im not wrong the above property will fire the server side function Handle drop, which is not happening in this scenario.

Even guide me how to raise the server side event for node click.

I have used OnNodeClick="MenuTree_NodeClick"

Note: I have observed no JavaScript errors in my page.

Thanks,
--Srinath
0
Atanas Korchev
Telerik team
answered on 30 May 2008, 10:47 AM
Hi Srinath,

Please check if the AutoEventWireUp attribute of your <%@ Page %> directive is set to true. This is required for event subscription through attributes (OnNodeDrop="RadTreeView1_HandleDrop")

Does the online example work when viewed from www.telerik.com?

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Srinath
Top achievements
Rank 1
answered on 30 May 2008, 12:32 PM
Online Eg is working fine.
AutoEventWireUp  is also true :(

But it is not working.

Any other ways.

Thanks,
--Srinath



0
Atanas Korchev
Telerik team
answered on 30 May 2008, 12:37 PM
Hi Srinath,

Please try starting from an empty form. Add a RadTreeView with some nodes. Then subscribe to the NodeClick event (you can double click RadTreeView in design time to do this). Let me know how it went.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Srinath
Top achievements
Rank 1
answered on 30 May 2008, 01:35 PM
Albert still it not working,

Could you please send me a Eg with
1. Node click server click funationality
2.Darg & Drop with onDrop server side functiona Call.

Thanks,
--Srinath
0
Atanas Korchev
Telerik team
answered on 30 May 2008, 01:45 PM
Hi Srinath,

What do you mean by "Eg"? What exactly happened when you created an empty web page containing only RadTreeView?

Please find attached a working example demonstrating how to handle the server-side NodeClick event. Using the NodeDrop event is similar. Please refer to our online documentation and demos for any additional information.

Greetings,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Srinath
Top achievements
Rank 1
Answers by
Paul
Telerik team
Srinath
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or