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

Help with Custom Attributes

2 Answers 52 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Luc Émond
Top achievements
Rank 1
Luc Émond asked on 28 Mar 2011, 03:00 PM
Hi,

I'am using this exemple :
http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/checkboxes/defaultcs.aspx

Each node is equal to a text, but to insert it in the database i need to pass an ID.
So is there a way to get ID from all the checkbox that are seleted?
By ID i mean the id that i passing from the database

Ex : If the user click the node
École Donat-Robichaud then this school as an unique id from the database = 1
École Secondaire-Assomption same thing id = 19

I hope i explan my self correctly

Here how i create my treeView :


<telerik:RadTreeView runat="server" ID="RadTreeView1" 
               DataSourceID="SqlRegionEcole" DataFieldID="id" 
               DataFieldParentID="parentId" CheckBoxes="true" TriStateCheckBoxes="true"  CheckChildNodes="true"
               DataValueField="Luc" Skin="Sunset">
                   <DataBindings>
                       <telerik:RadTreeNodeBinding TextField="Name" />
                         
                   </DataBindings>
              </telerik:RadTreeView>

With this i code i get all the name that are selected :
But i don't want the FullPath i need the ID that is selected

Protected Sub ShowCheckedNodes(ByVal treeView As RadTreeView)
        Dim message As String = String.Empty
        Dim nodeCollection As IList(Of RadTreeNode) = treeView.CheckedNodes
        For Each node As RadTreeNode In nodeCollection
                  message += node.FullPath + "<br/>"
        Next
        Label4.Text = message
    End Sub
  
  
  
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        ShowCheckedNodes(RadTreeView1)
    End Sub

Tks
Luc

2 Answers, 1 is accepted

Sort by
0
Luc Émond
Top achievements
Rank 1
answered on 28 Mar 2011, 06:47 PM
0
Veronica
Telerik team
answered on 29 Mar 2011, 09:12 AM
Hi Luc Émond,

I'm glad that you were able to find the solution on your own.

Please feel free to ask me if you have further questions.

Regards,
Veronica Milcheva
the Telerik team
Tags
TreeView
Asked by
Luc Émond
Top achievements
Rank 1
Answers by
Luc Émond
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or