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

Entity Data Source

2 Answers 95 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 08 Jun 2009, 01:33 PM
Hello,

I have a treeview which displays a SQL data source. Add the properties I configured the DataFielID and the DataFieldParentID. Thats works great so far. When I select a node I would like to get the whole SQL data row of the select node.  Right now I am just able to get the tex. But I need to pass the informations of the column LocPath to a other window. How can I access that?

Thanks for help.

 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title></title>  
</head> 
<body onloadonload=onload="AdjustRadWidow();"> 
 <script type="text/javascript">  
        function GetRadWindow()  
        {  
            var oWindow = null;  
            if (window.radWindow) oWindow = window.radWindow;  
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;  
            return oWindow;  
        }  
        function AdjustRadWidow() {  
            setTimeout(function() { GetRadWindow().autoSize() }, 200);  
        }  
 
        function returnToParent() {  
            //create the argument that will be returned to the parent page  
            var oArg = new Object();           
 
            //get the selected date from RadDatePicker  
            var treeView = $find("<%= RadTreeView1.ClientID %>");  
            var selectedNode = treeView.get_selectedNode();              
            oArg.TreeText = selectedNode._text;  
 
            //get a reference to the current RadWindow  
            var oWnd = GetRadWindow();  
 
            //Close the RadWindow and send the argument to the parent page  
            oWnd.close(oArg);  
        }  
        </script> 
 
 
    <form id="form1" runat="server">  
    <div> 
      
       <asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
        <telerik:RadTreeView ID="RadTreeView1" Runat="server" DataFieldID="LocPK"   
            DataFieldParentID="ParentLocPK" DataSourceID="LocationsQuery"   
            DataTextField="LocID" AppendDataBoundItems="True">  
        </telerik:RadTreeView> 
        <asp:SqlDataSource ID="LocationsQuery" runat="server"   
            ConnectionString="..." 
            SelectCommand="SELECT [LocPK], [LocID], [LocPath], [ParentLocPK]  FROM [MMLocations]">  
        </asp:SqlDataSource> 
        <button title="Submit" id="close" onclick="returnToParent(); return false;">  
                    Submit</button>      
    </div> 
    </form> 
</body> 
</html> 

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Jun 2009, 04:21 PM
Hello Christian,

You cannot associate the whole data row with a tree node. What you can do is store the field which corresponds to DataFieldID in the Value property. Then you can use the Value to retrieve the record which corresponds to a specific node.

<telerik:RadTreeView DataValueField="LocPK" />

If you need to access all data row details on the client-side you may consider using custom attributes.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Christian
Top achievements
Rank 1
answered on 09 Jun 2009, 10:39 AM
Hello,

thanks with the attributes I made a work around.
Tags
TreeView
Asked by
Christian
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Christian
Top achievements
Rank 1
Share this question
or