In RadTreeView, I want to add an image at right side of the node text for each nodes

10 posts, 0 answers
  1. Ubahariya
    Ubahariya avatar
    7 posts
    Member since:
    Aug 2011

    Posted 23 Feb 2012 Link to this post

    Hi Team,

    In RadTreeView, I want to add an image at right side of the node text for all the nodes in Client- Side.

    Description:
    1. Dynamically, I am adding nodes in the client side and here I wanted to place an image at right side of the node text(find attached for how I wanted) and I tried with "farimage" property, Image index property as the value of "1" and tried with many ways. But, all are not working out.

    In one way, I am able to achieve this, If I append an image with the text. But, I am getting an error ("A potentially dangerous Request.Form value was detected from the client ") while post occurs.

    I would be helpful if you send me an example.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2012 Link to this post

    Hello,

    One suggestion is that, you can add the image in the NodeTemplate as shown below.
    aspx:
    <NodeTemplate>
     <img src="Images/img1.gif" />
    </NodeTemplate>

    -Shinu.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ubahariya
    Ubahariya avatar
    7 posts
    Member since:
    Aug 2011

    Posted 23 Feb 2012 Link to this post

    Hi Shinu,

    Thanks for your reply.

    I am adding node values dynamically as follows,

    childNode.set_text(newarray[newarray.length - 1].get_text()); 

    childNode.set_imageUrl(
    '../Images/clear.png'); 

    in this case, I am able add an image at the left of the node text but not at the right side of the node text.

    Thanks & Regards
    Ubahariya



  5. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 28 Feb 2012 Link to this post

    Hi Ubahariya,

     
    You can change the place of the image with jQuery as in the code bellow:

    function pageLoad() {
                   $ = $telerik.$;
                   var first = $(".rtImg").each(function (a) {
                       $(this).parent().append($(".rtImg")[a]);
                   });
               }

    Hope this will be helpful.


    Kind regards,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Rafael
    Rafael avatar
    1 posts
    Member since:
    Mar 2012

    Posted 12 Mar 2012 Link to this post

    Hi, i want almost the same thing, but i would like to preserve the left image and add another one at right side but just for some new nodes.

    I had tried 
            Dim sourceNode As RadTreeNode = RadTreeView1.Nodes(0).Nodes(1).Nodes.FindNodeByText("Celular 1")
            Dim x As New RadTreeNode

            x.ImageUrl = "~/images/campoTexto.jpg"

            
            Dim A As New Label
            A.Text = "TEST "

            Dim B As New HtmlImage
            B.Src = "~/images/camera.jpg"

            Dim C As New HtmlImage
            C.Src = "~/images/video.png"

            x.Controls.Add(A)
            x.Controls.Add(B)
            x.Controls.Add(C)

            sourceNode.InsertAfter(x)

    All images have the same size.

    As you can see, this new node became unaligned

     

     

  7. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 15 Mar 2012 Link to this post

    Hello Rafael,

     
    You can refer to the Adding and Editing Templates at Runtime help topic, where is shown one way such functionality can be handled.

    Hope this will be helpful.

    Regards,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Mohamed
    Mohamed avatar
    1 posts
    Member since:
    Feb 2016

    Posted 25 Jul in reply to Ubahariya Link to this post

    Hi,

    As per your comments, there is an possibility to add an image on left side based on the condition. Could you please share all the codes relate to the left side image dynamically.

    Currently Iam able to hardcore the leftside image on RAD Treeview. But i want to display the left side image based on some condition from c#.

    Could you please help.

  9. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 28 Jul Link to this post

    Hello,

    One possible way is to use the DataBinding event of the control added as for example it is done with the label and the label1_DataBinding event and set the Image based on the text or value of the node.

    Regards,
    Plamen
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  10. Akiri
    Akiri avatar
    2 posts
    Member since:
    Dec 2014

    Posted 10 Oct Link to this post

    I have a treenode and a link button as shown below. And I'm showing the div which contains link button in Client data bound event of tree view.

    Problem here is link is not aligned in the same line for parent and child tree nodes. How can I fix the position of link same in all the nodes even while expanding.

     <Nodes>
        <telerik:RadTreeNode Width="20%" Text="Medispan Categories" ExpandMode="WebService" >
      </telerik:RadTreeNode> 

    </Nodes>  </telerik:RadTreeView>

       <div id="templateForMedispan" class="sys-template">
    <div style="float:right;width:60%"><a href="javascript:void(0);" onclick="{{'ShowDrugsFor(\'' + Code + '\',\'F\')' }}">View</a></div>
        </div>

  11. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 13 Oct Link to this post

    Hello,

    The code provided is not enough to replicate the issue. The scenario itself seems to be rather connected with a custom implementation than the control itself.

    Regards,
    Plamen
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017