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

[Solved] Access RadTreeView parent Control

5 Answers 220 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 03 Aug 2009, 12:58 PM
Hi,

In my implementation i have inserted a RadTreeview control inside RadCombobox which inturn is placed inside the RadGrid.
For one of my requirements i want that when user click on any node i want to attain handle of RadComboBox and do some operations on it.
But i am unable to find the parent conrol of Radtreeview.

Any ideas on how can this be done?

Regards,
Amit

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Aug 2009, 01:52 PM
Hi Amit,

I guess you have placed RadComboBox in GridTemplateColumn of grid like the setup shown below. If so you can access the RadComboBox by accessing the RadComboBoxItem and then the RadComboBox by using NamingContainer property. Give a try with following code and see whether this help you.

ASPX:
 
 . . .  
<telerik:GridTemplateColumn UniqueName="TemplateColumn">  
    <ItemTemplate> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server" Height="300px">  
            <Items> 
                <telerik:RadComboBoxItem runat="server" /> 
            </Items> 
            <ItemTemplate> 
                <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">  
                    <Nodes> 
                     . . .  
                    </Nodes> 
                </telerik:RadTreeView> 
            </ItemTemplate> 
        </telerik:RadComboBox> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 
 . . . 

C#:
 
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)  
{  
    RadTreeView tree = (RadTreeView)sender;  
    RadComboBoxItem comboItem = (RadComboBoxItem)tree.NamingContainer;  
    RadComboBox combo = (RadComboBox)comboItem.NamingContainer;  

Thanks,
Princy.
0
Amit
Top achievements
Rank 1
answered on 04 Aug 2009, 05:53 AM
Hey,

thanks for the reply.

I forgot to mention that i want to access this control in Javascript.
I am able to access it in C#,but i need to do so manipulation in JS.

Do you have any suggestion for it?

Thanks.
Amit
0
Shinu
Top achievements
Rank 2
answered on 04 Aug 2009, 07:01 AM
Hi Amit,

I tried following approach to get reference to client object of RadComboBox in OnClientNodeClicking event of RadTreeView. Give a try with the following code.

JavaScript:
 
<script type="text/javascript"
function OnClientNodeClicking(sender, args) 
    var text=sender.get_id(); // ClientID of RadTreeView 
    var index=text.lastIndexOf("RadComboBox1"); // RadComboBox1 is the ID of combobox 
    var ClientID=text.substring(0,index+12); 
    var combo = $find(ClientID); // Get reference to RadComboBox 
    alert(combo.get_text()); 
</script> 

Shinu.
0
Muddassar Maqsood
Top achievements
Rank 1
answered on 07 Oct 2009, 09:49 AM
Hi


What if i have 12 RadcomboBoxes, and inside each radcombobox i have a radtreeview. i need one javascript function to access the radtreeview and write its text on respective radcomboBox

Regards

Muddassar
0
Veselin Vasilev
Telerik team
answered on 08 Oct 2009, 01:45 PM
Hello guys,

I hope that the approach given here will help you
http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-reference-to-parent-radcombobox.aspx


All the best,
Veselin Vasilev
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
ComboBox
Asked by
Amit
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Amit
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Muddassar Maqsood
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or