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

ajax problem with Tree in UserControl

2 Answers 36 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jean-Marc
Top achievements
Rank 1
Jean-Marc asked on 12 Jan 2012, 12:28 PM

Hi,
I have an ascx that basiocally is just a tree.
this ascx is included on aspx file.
by clicking a button I want to change the tree datasource.
i see difference using ajaxmanager and triggers. First does not work the second does.
Unfortunally i need the first case

Here is a sample
(ajax)

<%@ Register TagPrefix="qsf" TagName="RTV" Src="~/Admin/CategoriesManagement/TreeCategories.ascx" %>
 
.....
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
     
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>                 
           <telerik:AjaxSetting AjaxControlID="Button1">
            <UpdatedControls>               
                <telerik:AjaxUpdatedControl ControlID="CatTree1" />               
            </UpdatedControls>
           </telerik:AjaxSetting>                      
        </AjaxSettings>
    </telerik:RadAjaxManager>   
 
     <table style="width: 100%; text-align: left; background-color:#2e2e2e;" cellspacing="0" cellpadding="0">                                  
        <tr>
            <td>
                <qsf:rtv runat="server" ID="CatTree1" ></qsf:rtv>   
            </td>
        </tr>
    </table>
        
    <asp:Button ID="Button1" runat="server" Text="Button" Width="500px" />
                                        
    </form>
...

code

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
           'change its datasource
            CatTree1.setInitialPath(PathOfThreeCategory)
 End Sub



second case (triggers)

<table style="width: 100%; text-align: left; background-color:#2e2e2e;" cellspacing="0" cellpadding="0">                                   
    <tr>
        <td>
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                </telerik:RadScriptManager>
 
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                            <qsf:rtv runat="server" ID="CatTree1" ></qsf:rtv>   
                    </ContentTemplate>
                                        
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Button1" />
                    </Triggers>
                </asp:UpdatePanel>
                                    
        </td>
    </tr>
</table>
 
 
<asp:Button ID="Button1" runat="server" Text="Button" Width="500px" />

same code behind..

Please May you tell me where i'm going wrong? Thank you

2 Answers, 1 is accepted

Sort by
0
Jean-Marc
Top achievements
Rank 1
answered on 12 Jan 2012, 03:47 PM
I dug in it.

It tuned out that my problem is tht the tree control is inside un updatepanel
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                            <telerik:RadTreeView    ID="RTV_Categories"                                                   
                                                Runat="server"
                                                >
                                            </telerik:RadTreeView>
                                    </ContentTemplate>
                                             
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="IB_AddNode" />
                                    </Triggers>
 
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="IB_DelNode" />
                                    </Triggers>
                                </asp:UpdatePanel>
 

so, is there a way to keep in the ascx the triggering on addnode and denNode controls and making ajax work?
Thank you
0
Kate
Telerik team
answered on 16 Jan 2012, 05:02 PM
Hello Jean-Marc,

In general when using web user controls it is strongly recommended that you use the RadAjaxManagerProxy control instead of the RadAjaxManager control as explained here. Please take a look at our on-line demos as well for a better understanding of its application. 

Kind regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
Jean-Marc
Top achievements
Rank 1
Answers by
Jean-Marc
Top achievements
Rank 1
Kate
Telerik team
Share this question
or