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

add a close button against each node

3 Answers 57 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rohan
Top achievements
Rank 1
Rohan asked on 28 Jan 2011, 06:45 AM
Hi,

I am binding the RadTReeView from the database. I want to add a image button against each node in RadTreeView. I tried it at the NodeDataBound event. But then the text disappeared and only the image button was showing up.
On the click of that image button I want to do delete the item from the database.

Please assist me...


Thanks
Rohan

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Jan 2011, 10:27 AM
Hello Rohan,


You could add the Button control in ItemTemplate so that you will be getting the button for each node. Now in the ButtonClick event, get the node by using NamingContainer property and get the node value to update the DB.


-Shinu.
0
Rohan
Top achievements
Rank 1
answered on 28 Jan 2011, 10:33 AM
Hi Shinu,

Thanks for replying. You mean to say "NodeTemplate". I used it like this:
<NodeTemplate>
                        <a style="cursor: pointer; position: absolute;" title="remove" onclick="">
                            <img src="../Content/Images/closenew.png" style="background-color: inherit;" alt="x" />
                        </a>
                    </NodeTemplate>
but the problem is that, its showing the image button but the text of the node is not there. i.e the nodes I was getting from the database is not there.

thanks
rohan
0
Yana
Telerik team
answered on 31 Jan 2011, 09:23 AM
Hi Rohan,

You should also bind the text of the nodes as demonstrated here.

Regards,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
TreeView
Asked by
Rohan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rohan
Top achievements
Rank 1
Yana
Telerik team
Share this question
or