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

How to update database ?

5 Answers 105 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 13 Jan 2009, 11:38 AM
Hi Team,
    I am using a tree view control to display the data from database . In my table there are 14 columns . I have implemented the load on demand . For the firtst time I am displaying second column as text and 1st column as its value . When user expanding the node I am taking that node value and displaying the next node ( 3rd column as value and 4th column as text and so on) . I cannot do this by using 3 columns in my table as "ParentId", "ChildId" and "Text" as we usually do to display the heirachical data .  I am allowing user to edit the text of the node or user can drag node from other tree view . After doing this I want to update the databse . Can you suggest me how can I able to update the database .

Regards
Manoj

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 Jan 2009, 11:43 AM
Hello Manoj,

You need to store the key of your database table in some way so you can later locate the database record corresponding to a specific tree node. If you are not able to use the Value property you can use the Category property or a custom attribute.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Manoj
Top achievements
Rank 1
answered on 13 Jan 2009, 11:57 AM
Hi Albert,
    Thanks for your reply . Can you send me with an example .

Regards
Manoj
0
Atanas Korchev
Telerik team
answered on 13 Jan 2009, 12:19 PM
Hello Manoj,

Populating a custom attribute is easy - subscribe to the NodeDataBound event

       protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
       {
           e.Node.Attributes["MyAttribute"] = Convert.ToString(DataBinder.Eval(
e.Node.DataItem, "MyColumn"));
       }

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kevin
Top achievements
Rank 2
answered on 04 Jan 2010, 01:25 PM
Is there a way to do this on the client?  I would like to iterate through all the nodes of the different treeviews on my page, then send them to a database table.  Can you do the update via the client?

--Kdc
0
Veselin Vasilev
Telerik team
answered on 06 Jan 2010, 04:50 PM
Hi Kevin,

This is not possible. What you can do is this - use the ajaxRequest client method of the RadAjaxManager to initiate an ajax request to the server where you can update the database.
Hope this is feasible for your case.

Greetings,
Veskoni
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
Manoj
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Manoj
Top achievements
Rank 1
Kevin
Top achievements
Rank 2
Veselin Vasilev
Telerik team
Share this question
or