Error when migrating from trial to purchased version : Treeview client-side event errors

8 posts, 0 answers
  1. Thomas Tourret
    Thomas Tourret avatar
    5 posts
    Member since:
    Oct 2008

    Posted 17 Nov 2008 Link to this post

    Hi,

    I worked on telerik last trial version before buying it, to see if it matched my needs, but now that I want to use the purchased version, I got errors on one of my treeview.

    I keep getting :
    _145 has no properties
    Function.__typeName="Function";Function....erClass("Sys.UI.Control",Sys.Component);

    I have no more action possible on my treeview, and I can't see why. Since it worked great before with the trial version, I suppose changes were made between the two version. Has anyone got this problem to?

    thanx for your support

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Nov 2008 Link to this post

    Hello Thomas Tourret,

    This looks as a if a JavaScript file failed to load. Are you using RadScriptManager in your page? If yes could you please try setting the EnableScriptCombine property to false and see if it works?

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Thomas Tourret
    Thomas Tourret avatar
    5 posts
    Member since:
    Oct 2008

    Posted 17 Nov 2008 Link to this post

    Thank you for quick responding,
    unfortunatly, it hasn't changed a thing :s

    I don't understand why i'm having this problem, since I got nearly the same code on another page which did not suffer from the migration.

    I hope you can give me some more intel on that issue soon.


  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Nov 2008 Link to this post

    Hi Thomas Tourret,

    We are not sure why this problems occur. Please post here your sample page - perhaps this would shed some light.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Thomas Tourret
    Thomas Tourret avatar
    5 posts
    Member since:
    Oct 2008

    Posted 18 Nov 2008 Link to this post

    Hi,

    I join the page on which I use the radtreeview, its a usercontrol, no reference to radscriptmanager is in it as it is referenced in a MasterPage.

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CreationMedia.ascx.cs"  
    Inherits="OpinionRateWeb.UserControls.CreationMedia" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <asp:UpdatePanel runat="server" ID="CreationTagUpdatePanel"
        <ContentTemplate> 
            <table> 
                <tr> 
                    <td align="left" valign="top" style="width:40%;"
                        <asp:TextBox ID="MediaTextbox" runat="server"></asp:TextBox> 
                        <asp:Button ID="AddMedia" runat="server" Text="Add as Media" OnClick="AddMedia_Click" /> 
                    </td> 
                     
                     
                    <td style="width:60%;" align="center"
                 
                      <telerik:RadTreeView ID="MediasPreviewTree" runat="server" EnableDragAndDrop="True" 
                            OnNodeDrop="RadTreeView1_HandleDrop" EnableViewState="true" 
                            Skin="Vista" EnableDragAndDropBetweenNodes="True" CssClass="treeitems"  
                            oncontextmenuitemclick="MediasPreviewTree_ContextMenuItemClick" 
                             >  
                            <CollapseAnimation Duration="100" Type="OutQuint" /> 
                            <ExpandAnimation Duration="100" /> 
                            <ContextMenus> 
                            <telerik:RadTreeViewContextMenu ID="TreeViewContextMenu" 
                            runat="server"
                            <Items> 
                            <telerik:RadMenuItem Value="Delete" Text="Delete" PostBack="true"></telerik:RadMenuItem> 
                            </Items> 
                            </telerik:RadTreeViewContextMenu> 
                             
                            </ContextMenus> 
                        </telerik:RadTreeView> 
                    </td> 
                </tr> 
            </table> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
    the treeview is entirely build programmaticaly, so I join the ascx.cs file :

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using DataBusinessObjects; 
    using Telerik.Web.UI; 
     
    namespace ***.UserControls 
        public partial class CreationMedia : System.Web.UI.UserControl 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            { 
     
                if (!IsPostBack) 
                    PopulateTreeView(); 
                MediasPreviewTree.ExpandAllNodes(); 
            } 
     
            private void PopulateTreeView() 
            { 
                List<Media> tags = BusinessLayer.MediaManagement.GetAllMedias(); 
                tags = SortMediaList(tags); 
                foreach (Media tag in tags) 
                { 
                    MyTreeViewNode nod = new MyTreeViewNode(tag.Type, tag.Id, tag.ParentId); 
                    if (nod.Attributes["ParentId"] == "-1"
                    { 
                        MediasPreviewTree.Nodes.Add(nod); 
                        continue
                    } 
                    foreach (MyTreeViewNode o in MediasPreviewTree.Nodes) 
                    { 
                        if (o.InsertNode(nod)) 
                            break
                    } 
                } 
            } 
     
            private List<Media> SortMediaList(List<Media> medias) 
            { 
                List<Media> res = new List<Media>(); 
                List<Media> todo = new List<Media>(); 
                todo = todo.Concat(medias).ToList(); 
     
                foreach (Media media in medias) 
                { 
                    if (todo.Contains(media)) 
                    { 
                        if (media.ParentId == -1) 
                        { 
                            res.Add(media); 
                            todo.Remove(media); 
                        } 
                        else 
                        { 
                            ParentAdding(res, todo, media); 
                        } 
                    } 
                } 
                return res; 
            } 
     
            private void ParentAdding(List<Media> res, List<Media> todo, Media current) 
            { 
                while (current.ParentId != -1 && todo.Find(o => o.Id == current.ParentId) != null
                    ParentAdding(res, todo, todo.Find(o => o.Id == current.ParentId)); 
                res.Add(current); 
                todo.Remove(current); 
            } 
     
     
            protected void AddMedia_Click(object sender, EventArgs e) 
            { 
                if (!BusinessLayer.MediaManagement.MediaExists(MediaTextbox.Text)) 
                { 
                    decimal id = BusinessLayer.MediaManagement.AddMedia(MediaTextbox.Text); 
                    MyTreeViewNode node = new MyTreeViewNode(MediaTextbox.Text, id, -1); 
                    MediasPreviewTree.Nodes.Add(node); 
                } 
            } 
     
            protected void RadTreeView1_HandleDrop(object sender, RadTreeNodeDragDropEventArgs e) 
            { 
                MyTreeViewNode sourceNode = (MyTreeViewNode)e.SourceDragNode; 
                MyTreeViewNode destNode = (MyTreeViewNode)e.DestDragNode; 
                if (sourceNode != null && destNode != null
                { 
                    if (destNode.Level == 0) 
                    { 
                        sourceNode.Attributes["ParentId"] = "-1"
                        BusinessLayer.MediaManagement.LinkMedias(-1, decimal.Parse(sourceNode.Value)); 
                    } 
                    RadTreeViewDropPosition dropPosition = e.DropPosition; 
                    if (dropPosition == RadTreeViewDropPosition.Above || 
                        dropPosition == RadTreeViewDropPosition.Below) 
                    { 
                        sourceNode.Attributes["ParentId"] = destNode.Attributes["ParentId"]; 
                        BusinessLayer.MediaManagement.LinkMedias(decimal.Parse(destNode.Attributes["ParentId"]), 
                            decimal.Parse(sourceNode.Value)); 
                    } 
     
                    if (destNode != null
                    { 
                        if (sourceNode.TreeView.SelectedNodes.Count <= 1) 
                        { 
                            PerformDragAndDrop(dropPosition, sourceNode, destNode); 
                        } 
                        else if (sourceNode.TreeView.SelectedNodes.Count > 1) 
                        { 
                            foreach (MyTreeViewNode node in sourceNode.TreeView.SelectedNodes) 
                            { 
                                PerformDragAndDrop(dropPosition, node, destNode); 
                            } 
                        } 
                        destNode.Expanded = true
                        sourceNode.TreeView.ClearSelectedNodes(); 
                    } 
                } 
            } 
     
     
            private static void PerformDragAndDrop(RadTreeViewDropPosition dropPosition, MyTreeViewNode sourceNode, MyTreeViewNode destNode) 
            { 
                if (sourceNode.Equals(destNode) || sourceNode.IsAncestorOf(destNode)) 
                { 
                    return
                } 
                sourceNode.Owner.Nodes.Remove(sourceNode); 
     
                switch (dropPosition) 
                { 
                    case RadTreeViewDropPosition.Over: 
                        // child 
                        if (!sourceNode.IsAncestorOf(destNode)) 
                        { 
                            BusinessLayer.MediaManagement.LinkMedias(decimal.Parse(destNode.Value), decimal.Parse(sourceNode.Value)); 
                            sourceNode.Attributes["ParentId"] = destNode.Value; 
                            destNode.Nodes.Add(sourceNode); 
                        } 
                        break
     
                    case RadTreeViewDropPosition.Above: 
                        // sibling - above                     
                        destNode.InsertBefore(sourceNode); 
                        break
     
                    case RadTreeViewDropPosition.Below: 
                        // sibling - below 
                        destNode.InsertAfter(sourceNode); 
                        break
                } 
            } 
     
            protected void MediasPreviewTree_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) 
            { 
                switch (e.MenuItem.Value) 
                { 
                    case "Delete"
                        BusinessLayer.MediaManagement.DeleteMedia(long.Parse(e.Node.Value)); 
                        MediasPreviewTree.Nodes.Clear(); 
                        PopulateTreeView(); 
                        MediasPreviewTree.ExpandAllNodes(); 
                        break
     
                } 
            } 
        } 
    That might be to much, but still I'm really stuck with this page. I hope you can help me find a solution, or I'll have to do the page again from scratch, which is something you certainly understand I wouldn't enjoy to much to do.

    Thanx





  6. Thomas Tourret
    Thomas Tourret avatar
    5 posts
    Member since:
    Oct 2008

    Posted 18 Nov 2008 Link to this post

    Hi,
    I'm back with some more info on my error.

    I tried a few things :

    1. I tried my other treeview on the same page, didn't work, same problem
    2. I tried the simplest treeview possible, that is no drag&drop and other stuffs like that, just populating my treeview programmaticaly and that's all, didn't work also
    3. I tried using my treeview which didn't work on a brand new page, IT WORKS!

    So I suppose there's something on my page which make the radtreeview bug. I'll now explain how my page is driven :


    1. I use MasterPage + Nested MasterPage to get all the design and stuffs that are the same on each page (menubar, design).
    2. I created a usercontrol which contains my treeview, a textbox and a button (the code I actually send in last most)
    3. this usercontrol is then referenced in my page
    I don't know why it doesn't work, as all my pages are made this way, and they all work.

    I hope these info can help

    Sincerely
  7. Thomas Tourret
    Thomas Tourret avatar
    5 posts
    Member since:
    Oct 2008

    Posted 19 Nov 2008 Link to this post

    Hi,

    Just to tell that I managed to make it work, but against my will I'ld say because I had to put my page out of the masterPage to make it work, which is for me not a true solution, but only a trick. Anyway, I got my page again working so no need to worry more than necessary.

    Thank you for your help (even if it wasn't that helpfull)
  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Nov 2008 Link to this post

    Hi Thomas Tourret,

    It seems this problem is very specific to your configuration/scenario.
    If you send us a sample project where we can reproduce the issue - we will be more helpful.

    All the best,
    Veselin Vasilev
    the Telerik team

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