set_imageUrl() not working

2 posts, 0 answers
  1. Vincent
    Vincent avatar
    2 posts
    Member since:
    Apr 2012

    Posted 18 Apr 2012 Link to this post

    Hy,

    The javascript function set_imageUrl() is not working for me if node.get_nodes().get_count() > 0;
    For test, i'm only ckeck child node.

    The parent node are checking to, and partial text appear, but only the last child are changing image.

    function CheckNodeChildren(node, isChecked)
     {
         var nbChildrenNode = node.get_nodes().get_count();
         if (nbChildrenNode > 0)
         {
             for (var i = 0; i < nbChildrenNode; i)
             {
                 var childNode = node.get_nodes().getNode(i);
                 DetermineMode(childNode, isChecked, false);
                 CheckNodeChildren(childNode, isChecked);
             }
             return true;
         }
         else return false;
    }
     
    function DetermineMode(node, isAllNodeChecked, isSomeNodeChecked)
    {
     if (isAllNodeChecked)
     {
         SetMode_TotalAccess(node);
     }
     else if (isSomeNodeChecked)
     {
         SetMode_PartialAccess(node);
     }
     else
     {
         SetMode_ForbiddenAccess(node);
     }
    }
             
    function SetMode_TotalAccess(node)
    {
     node.set_checked(true);
     node.set_imageUrl("/image/checked.gif");
     node.set_text("Total");
    // node.set_toolTip(\  TOOLTIP_PictureTotal  \);
    }
    function SetMode_ForbiddenAccess(node)
    {
     node.set_checked(false);
     node.set_imageUrl("/image/deleted.gif");
     node.set_text("Forbidden");
    // node.set_toolTip(\  TOOLTIP_PictureForbidden  \);
    }
    function SetMode_PartialAccess(node)
    {
     node.set_checked(false);
     node.set_imageUrl("/image/partial.gif");
     node.set_text("Partial");
    // node.set_toolTip(\  TOOLTIP_PicturePartial  \);
    }
  2. Vincent
    Vincent avatar
    2 posts
    Member since:
    Apr 2012

    Posted 18 Apr 2012 Link to this post

    I found a solution, with add of javascript function :

    function SetImage(node, url, tooltip)
    {
        var image = node.get_imageElement();
        image.alt = tooltip;
        image.src = url;
    }

    Simply access to ImageElement, you can changes src and alt values.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top