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

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

9 Answers 186 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ubahariya
Top achievements
Rank 1
Ubahariya asked on 23 Feb 2012, 05:32 PM
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.

9 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 24 Feb 2012, 05:06 AM
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.

0
Ubahariya
Top achievements
Rank 1
answered on 24 Feb 2012, 05:17 AM
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



0
Plamen
Telerik team
answered on 28 Feb 2012, 11:37 AM
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.
0
Rafael
Top achievements
Rank 1
answered on 12 Mar 2012, 06:33 PM
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

 

 

0
Plamen
Telerik team
answered on 15 Mar 2012, 04:11 PM
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.
0
Mohamed
Top achievements
Rank 1
answered on 25 Jul 2016, 11:28 AM

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.

0
Plamen
Telerik team
answered on 28 Jul 2016, 07:51 AM
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.
0
Akiri
Top achievements
Rank 1
answered on 10 Oct 2016, 11:15 AM

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>

0
Plamen
Telerik team
answered on 13 Oct 2016, 06:36 AM
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.
Tags
TreeView
Asked by
Ubahariya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Ubahariya
Top achievements
Rank 1
Plamen
Telerik team
Rafael
Top achievements
Rank 1
Mohamed
Top achievements
Rank 1
Akiri
Top achievements
Rank 1
Share this question
or