RadTreeView functionality is gone after ajax callback

7 posts, 0 answers
  1. Amir
    Amir avatar
    16 posts
    Member since:
    Sep 2006

    Posted 15 Oct 2009 Link to this post

    Hi,
    I am using RadTreeView from telerik Radcontrols for ASP.Net ajax q2 2009 and RadAjax from telerik radcontrols for asp.net (version 1.8.5) in a page.
    on page load everything works fine but when the panel which contains treeview is updated by Ajax Manager, every functionality of treeview is gone.
    Before this i had RadTreeView for asp.net (version 6.0.3) and everything worked fine.
    but when I upgraded it to asp.net ajax the problem above appeared.

    what should I do?



  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 15 Oct 2009 Link to this post

    Hi Amir,

    You should use RadAjax for ASP.NET Ajax in order to make successful updates of ajax controls. The older version does not work properly with the newer controls.

    Regards,
    Albert,
    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.
  3. Amir
    Amir avatar
    16 posts
    Member since:
    Sep 2006

    Posted 16 Oct 2009 Link to this post

    Hi, I tried to use RadAjax for ASP.Net Ajax but, I got the error:
    "The Controls collection cannot be modified because the control contains code blocks"
    My Page is a multilingual page and I Have lots of Resource uses in page like <%=Resources.Resource.aaaa%>.
    Should I put all of them in RadCodeBlock control?!!!
    note: This is a Web User Control which is loaded in a page which has ScriptManager as first Control.

    Regads
    Amir
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 16 Oct 2009 Link to this post

    Hello Amir,

    Yes, all server side expressions and blocks (<%= %>) should be put inside RadCodeBlock controls.

    Regards,
    Albert,
    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.
  5. Amir
    Amir avatar
    16 posts
    Member since:
    Sep 2006

    Posted 16 Oct 2009 Link to this post

    Hi Albert,
    I Upgraded the RadAjax to ASP.Net Ajax and corrected all (<%= %>) blocks. All the controls are now Q2 2009.
    Now the ajax works fine, but the main problem still exists:
    After the ajax callback the treeview becomes not functional, it seems that the scripts are not loaded.
    For example there is a delete button on the page to delete the selected node on the tree, when i click on it the node is deleted server side but after call back the tree falls apart.

    Best Regards
    Amir
  6. Amir
    Amir avatar
    16 posts
    Member since:
    Sep 2006

    Posted 16 Oct 2009 Link to this post

    Hi Albert,
    I made a simple scenario to replicate the problem, I created a web user control and a page to load it. I put ScriptManager in the page and a treeview and an ajaxmanager in user control and a button to remove a node from tree. when I press the button the tree becomes inactive. I could not figure out what is the problem.

    Here is the code for page(webform5.aspx):
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="Intranet.WebForm5" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
            <asp:ScriptManager ID="ScriptManager1" runat="server"
            </asp:ScriptManager> 
            <asp:Panel runat=server ID=panel1></asp:Panel> 
        </div> 
        </form> 
    </body> 
    </html> 
     
     
    and here is the code behind of the page(webform5.aspx.cs):
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
     
    namespace Intranet 
        public partial class WebForm5 : System.Web.UI.Page 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            { 
                panel1.Controls.Add(Page.LoadControl("~/webform4.ascx")); 
            } 
        } 

    and here is the user control html (webform4.ascx):
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.ascx.cs" Inherits="Intranet.WebForm4" %> 
     
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  
            DefaultLoadingPanelID="RadAjaxLoadingPanel1"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Button1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <div> 
         
        </div> 
        <telerik:RadTreeView ID="RadTreeView1" Runat="server"
            <Nodes> 
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1"
                    <Nodes> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 3"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 4"
                        </telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode2"
                    <Nodes> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 3"
                        </telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode3"
                    <Nodes> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 3"
                        </telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeNode> 
            </Nodes> 
        </telerik:RadTreeView> 
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"  
            Skin="Default"
        </telerik:RadAjaxLoadingPanel> 

    and here is the code behind of the control(webform4.ascx.cs):
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
     
    namespace Intranet 
        public partial class WebForm4 : UserControl 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            { 
            } 
     
            protected void Button1_Click(object sender, EventArgs e) 
            { 
                RadTreeView1.Nodes.RemoveAt(0); 
            } 
        } 
     

    Best Regards
    Amir


  7. Amir
    Amir avatar
    16 posts
    Member since:
    Sep 2006

    Posted 16 Oct 2009 Link to this post

    HI,
    I found the solution by reading RadAjax docs,
    I moved RadAjaxManager to the Page and used a RadAjaxManagerProxy in Web User control.
    Now everything works fine.

    Thanx
    Amir
Back to Top