[CLOSED] not show icons in treepanel

  1. #1

    [CLOSED] not show icons in treepanel

    I have a problem with changing the version of Ext Net
    I had version 2.2 and I switched to version 2.3
    This caused the treepanel no longer show icons
    only shows default icons

    Use the following lines in codebehind:

    Dim nodoOpcion As New Node
     nodoOpcion.IconFile = ResolveUrl("./Imagenes/Iconos/" + opc.Icono + ".png")
    Note: opc.Icono is a value I get from the database.

    what do I require modify?

    thanks!
    Last edited by Baidaly; Nov 20, 2013 at 4:48 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Couldn't reproduce your issue. Double check that the icon file exists. I'd start by checking result HTML in Firebug or Chrome developers tools.

    Also, it's strange that you use relative URL: ./Imagenes/Iconos/ . It's better to use global URL: ~/Imagenes/Iconos/
    If it seems OK, try to use IconCls instead of IconFile:

    Declare CSS:

    <style>
        .my-tree-icon {
            background-image: url(thumbnail.gif) !important;
        }
    </style>
    Use in IconCls:
    <ext:Node Text="MyNode" Expanded="true" IconCls="my-tree-icon">
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Couldn't reproduce your issue. Double check that the icon file exists. I'd start by checking result HTML in Firebug or Chrome developers tools.

    Also, it's strange that you use relative URL: ./Imagenes/Iconos/ . It's better to use global URL: ~/Imagenes/Iconos/
    If it seems OK, try to use IconCls instead of IconFile:

    Declare CSS:

    <style>
        .my-tree-icon {
            background-image: url(thumbnail.gif) !important;
        }
    </style>
    Use in IconCls:
    <ext:Node Text="MyNode" Expanded="true" IconCls="my-tree-icon">
    so icons are displayed:

    Click image for larger version. 

Name:	iconos.JPG 
Views:	5 
Size:	12.2 KB 
ID:	7231



    I need to use in the codebehind, have any suggestions? thanks
  4. #4
    Quote Originally Posted by JCarlosF View Post
    so icons are displayed:

    Click image for larger version. 

Name:	iconos.JPG 
Views:	5 
Size:	12.2 KB 
ID:	7231



    I need to use in the codebehind, have any suggestions? thanks
    Sorry, what was wrong? Why does it work now? On the picture I see only default pictures. I just don't quite follow you.
  5. #5
    Quote Originally Posted by Baidaly View Post
    Sorry, what was wrong? Why does it work now? On the picture I see only default pictures. I just don't quite follow you.


    I just want to show icons so:

    Click image for larger version. 

Name:	Captura.JPG 
Views:	5 
Size:	11.6 KB 
ID:	7232


    that he succeeded in version 2.2 with the next section of code in codebehind:

        Dim nodoOpcion As New Node
        nodoOpcion.IconFile = ResolveUrl("./Imagenes/Iconos/" + opc.Icono + ".png")
        Dim NodoIcono As New ConfigItem("icono", "./Imagenes/Iconos/" + opc.Icono + ".png") 
        NodoIcono.Mode = ParameterMode.Value
        nodoOpcion.CustomAttributes.Add(NodoIcono)
    but already in version 2.3 does not work
  6. #6
    Try the following sample, does it work for you?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
    
            this.PlaceHolder1.Controls.Add(tree);
    
            tree.ID = "TreePanel1";
            tree.Width = Unit.Pixel(300);
            tree.Height = Unit.Pixel(450);
            tree.Icon = Icon.BookOpen;
            tree.Title = "Catalog";
            tree.AutoScroll = true;
    
            Ext.Net.Node root = new Ext.Net.Node()
                                    {
                                        Text = "Composers",
                                        IconFile = "http://speed.ext.net/ext.net/2.3.1/icons/information.png",
                                        Leaf = true
                                    };
            tree.Root.Add(root);
        }
    </script>
    
    <!DOCTYPE html>
        
    <html>
    <head runat="server">
        <title>Multi Node TreePanel built from code-behind - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <asp:PlaceHolder ID="PlaceHolder1" runat="server" />
        </form>
    </body>
    </html>
  7. #7
    Quote Originally Posted by Baidaly View Post
    Try the following sample, does it work for you?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
    
            this.PlaceHolder1.Controls.Add(tree);
    
            tree.ID = "TreePanel1";
            tree.Width = Unit.Pixel(300);
            tree.Height = Unit.Pixel(450);
            tree.Icon = Icon.BookOpen;
            tree.Title = "Catalog";
            tree.AutoScroll = true;
    
            Ext.Net.Node root = new Ext.Net.Node()
                                    {
                                        Text = "Composers",
                                        IconFile = "http://speed.ext.net/ext.net/2.3.1/icons/information.png",
                                        Leaf = true
                                    };
            tree.Root.Add(root);
        }
    </script>
    
    <!DOCTYPE html>
        
    <html>
    <head runat="server">
        <title>Multi Node TreePanel built from code-behind - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <asp:PlaceHolder ID="PlaceHolder1" runat="server" />
        </form>
    </body>
    </html>

    This example did work, and with that I could solve my problem,
    I detected that the image path did not work, I had to change it so:

      nodoGrupo.IconFile = "/Imagenes/Iconos/" + iconname
    but I do not know why in Ext Net version 2.2 that problem did not exist,
    finally is solved, thanks!

Similar Threads

  1. [CLOSED] MVC partial load - icons don't show
    By boris in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 05, 2012, 9:19 AM
  2. Replies: 5
    Last Post: Jul 22, 2011, 7:41 AM
  3. Replies: 5
    Last Post: Mar 23, 2011, 9:57 AM
  4. [CLOSED] Triggerfield icons don't show
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 02, 2010, 3:55 PM
  5. icons dont show
    By tonymayoral in forum 1.x Help
    Replies: 3
    Last Post: May 23, 2009, 9:59 PM

Posting Permissions