ComboBox with TreeView refreshes page

7 posts, 0 answers
  1. Alex Tushinsky
    Alex Tushinsky avatar
    52 posts
    Member since:
    Feb 2006

    Posted 14 Aug 2008 Link to this post

    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

  2. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 15 Aug 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Alex Tushinsky
    Alex Tushinsky avatar
    52 posts
    Member since:
    Feb 2006

    Posted 15 Aug 2008 Link to this post

    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
  5. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 18 Aug 2008 Link to this post

    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.
  6. Alex Tushinsky
    Alex Tushinsky avatar
    52 posts
    Member since:
    Feb 2006

    Posted 18 Aug 2008 Link to this post

    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
  7. Dave Forster
    Dave Forster avatar
    5 posts
    Member since:
    May 2008

    Posted 03 Sep 2008 Link to this post

    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 ?
  8. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 01 Oct 2008 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017