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

ComboBox with TreeView refreshes page

6 Answers 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Alex Tushinsky
Top achievements
Rank 2
Alex Tushinsky asked on 15 Aug 2008, 01:49 AM
I have a RadComboBox with a RadTreeView inside.  All of this is inside a RadPanel.  And the RadPanel is inside a UserControl, which is hosted by a master page which has a updatepanel around the entire thing.

                   <telerik:RadComboBox ID="lstCats" Runat="server" Skin="Gray" DropDownWidth="375px" Width="160px">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="" Value="" /> 
                        </Items> 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        <ItemTemplate> 
                          <telerik:RadTreeView ID="rtCats" Runat="server" Skin="Gray" OnNodeClick="rtCats_NodeClick">  
                                <CollapseAnimation Duration="100" Type="OutQuint" /> 
                                <ExpandAnimation Duration="100" /> 
                            </telerik:RadTreeView> 
                         </ItemTemplate> 
                    </telerik:RadComboBox> 

In order to get the data from the treeview to the combo box, I wrote the following routine:

    Protected Sub rtCats_NodeClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadTreeNodeEventArgs)  
        Dim lstCats As RadComboBox  
        lstCats = RadPanelBar1.Items(0).FindControl("lstCats")  
        lstCats.SelectedValue = e.Node.Value  
        lstCats.SelectedItem.Text = e.Node.Text  
        lstCats.SelectedItem.ToolTip = e.Node.FullPath  
    End Sub 

Unfortunately, it seems that every time I click on item in the tree, the entire page refreshes.  It actually does a postback, but its as if there's no updatepanel.  The entire page re-loads.

What am I doing wrong?  Other RadCombo boxes on the same page that use the standard RadComboItem do not seem to have this problem.  The button next to the control posts back correctly as well. 

Any help is greatly appreciated!

Thanks,
Alex

6 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 15 Aug 2008, 04:12 PM
Hello Alex,

Could you please place the update panel around the treeview like in the code below:

<telerik:RadPanelBar ID="RadPanel1" runat="server">  
                <CollapseAnimation Duration="100" Type="None" /> 
                <Items> 
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem1">  
                        <Items> 
                            <telerik:RadPanelItem runat="server">  
                                <ItemTemplate> 
                                    <telerik:RadComboBox ID="lstCats" runat="server" Skin="Gray" DropDownWidth="375px" 
                                        Width="160px">  
                                        <Items> 
                                            <telerik:RadComboBoxItem runat="server" /> 
                                        </Items> 
                                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                        <ItemTemplate> 
                                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
                                                <ContentTemplate> 
                                                    <telerik:RadTreeView ID="rtCats" runat="server" Skin="Gray" OnNodeClick="rtCats_NodeClick" 
                                                        Height="229px" Width="230px">  
                                                        <CollapseAnimation Duration="100" Type="OutQuint" /> 
                                                        <ExpandAnimation Duration="100" /> 
                                                        <Nodes> 
                                                            <telerik:RadTreeNode runat="server" Text="Node1">  
                                                                <Nodes> 
                                                                    <telerik:RadTreeNode runat="server" Text="Node11">  
                                                                    </telerik:RadTreeNode> 
                                                                    <telerik:RadTreeNode runat="server" Text="Node12">  
                                                                    </telerik:RadTreeNode> 
                                                                    <telerik:RadTreeNode runat="server" Text="Node13">  
                                                                    </telerik:RadTreeNode> 
                                                                </Nodes> 
                                                            </telerik:RadTreeNode> 
                                                            <telerik:RadTreeNode runat="server" Text="Node2">  
                                                            </telerik:RadTreeNode> 
                                                            <telerik:RadTreeNode runat="server" Text="Node3">  
                                                            </telerik:RadTreeNode> 
                                                        </Nodes> 
                                                    </telerik:RadTreeView> 
                                                </ContentTemplate> 
                                            </asp:UpdatePanel> 
                                        </ItemTemplate> 
                                    </telerik:RadComboBox> 
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelItem> 
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2">  
                    </telerik:RadPanelItem> 
                </Items> 
                <ExpandAnimation Duration="100" Type="None" /> 
            </telerik:RadPanelBar> 

See whether it behaves differently.



Regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alex Tushinsky
Top achievements
Rank 2
answered on 15 Aug 2008, 09:17 PM
I did try that yesterday before I made my initial post, and that didn't help matters.  Still does a full postback via browser, and not the UpdatePanel.

Thanks,
Alex
0
Helen
Telerik team
answered on 18 Aug 2008, 01:18 PM
Hello Alex,

Please find attached a project as part of our local tests. It works as expected at our side.

Could you try something similar at your side?


Regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alex Tushinsky
Top achievements
Rank 2
answered on 18 Aug 2008, 05:59 PM
Yes, actually that did work.  The trick was to put the update panel into the <ItemTemplate> of the ComboBox.

I do find that a bit strange through, considering that there is an UpdatePanel around the whole thing in the first place.

Thanks,
Alex
0
Dave Forster
Top achievements
Rank 1
answered on 03 Sep 2008, 06:37 PM
I ran into the same problem recently... my combo with treeview is wrapped in a MS Ajax Update Panel rather than the telerik.  Whenever a tree node was clicked it caused a full postback regardless of update panel.

The solution lies in the rather obscurely named javascript method of the combo :
attachDropDown() 

This article helped me out but I can't say I understand why it's needed :
http://www.telerik.com/help/aspnet-ajax/troubleshooting-ajaxified-control-item-template-full-postback.html

Is it me or do you continually feel like you're jumping through flaming hoops trying to get the telerik controls to do the simplest of things correctly ?
0
towpse
Top achievements
Rank 2
answered on 01 Oct 2008, 02:22 PM
I have an update panel around a MS panel that holds a bunch of stuff including a radCombo with a tree view in its item template.
The update panel is displayed as a popup by the ajaxmodalpopupextender.

The combo is responding to the click but the tree view item template is being renedred under the panel that is displayed by the popupextender... Not sure what to do about this. Can anyone help?



matt.
Tags
ComboBox
Asked by
Alex Tushinsky
Top achievements
Rank 2
Answers by
Helen
Telerik team
Alex Tushinsky
Top achievements
Rank 2
Dave Forster
Top achievements
Rank 1
towpse
Top achievements
Rank 2
Share this question
or