RadTreeView context menu issue

2 posts, 0 answers
  1. Aleks
    Aleks avatar
    3 posts
    Member since:
    Aug 2007

    Posted 04 Nov 2009 Link to this post

    Hello,

     

    I have a rad tree view implemented in a user control, and that usercontrol is implemented in a radsplitter on a left side pane. Now what I havealready done is set that when a node is clicked,

    to open the content in the right pane with node target. What i can'tseem to do is make the same effect when i right click the menu and select editcategory, i catch the event in the codebehind,

    and change the ContentUrl of the pane. But the pane doesn't refresh. SoI added the whole splitter in an update panel, and grab that when the eventoccurs and make it refresh. But then

    I am getting this javascript errors: Without the update panel the rightpane doesn't refresh, and with it i am getting these errors.

     

    Microsoft JScript runtime error: Sys.InvalidOperationException: Acontrol is already associated with the element.

     

    Microsoft JScript runtime error: Sys.InvalidOperationException: Twocomponents with the same id 'ctl00_TreeMenu_MainMenu_MainContextMenu' can't beadded to the application.

     

    Microsoft JScript runtime error: Sys.InvalidOperationException: Acontrol is already associated with the element.

     

    Microsoft JScript runtime error: Sys.InvalidOperationException: Twocomponents with the same id 'ctl00_TreeMenu_MainMenu' can't be added to theapplication.

     

    The code works but, why are the erorrs showing.

     

    CODE OF MASTER PAGE:

     

     <asp:ScriptManager ID="ScriptManager1" runat="server">

            <Services>

                <asp:ServiceReference Path="~/WebService1.asmx" />

            </Services>

        </asp:ScriptManager>

       <div id="wrapper">

            <div id="headerHolder">

                <uc:Header ID="MainHeader" runat="server"></uc:Header>

            </div>

            <div id="MainContent">

                <%--<telerik:RadAjaxPanel ID="asdf"runat="server">--%>

                <asp:UpdatePanel ID="bu" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">

                <ContentTemplate>

                     <telerik:RadSplitter ID="MainSplitter" runat="server" Width="99%" Height="1000px"

                            VisibleDuringInit="false">

                            <telerik:RadPane ID="LeftPane"runat="server"Width="18%">

                                <asp:UpdatePanel ID="UpdatePanelTree"runat="server"UpdateMode="Conditional">

                                    <ContentTemplate>

                                        <uc:TreeMenu ID="TreeMenu"runat="server"/>

                                    </ContentTemplate>

                                </asp:UpdatePanel>

                            </telerik:RadPane>

                            <telerik:RadSplitBar ID="VerticallSplitBar"runat="server"CollapseMode="Both"/>

                            <telerik:RadPane ID="UpPane" runat="server"ContentUrl="about:blank">

                                <asp:ContentPlaceHolderID="UpContent"runat="server">

                                </asp:ContentPlaceHolder>

                            </telerik:RadPane>

                        </telerik:RadSplitter>

                </ContentTemplate>

                </asp:UpdatePanel>

                  

            

            </div>

     

    CODE OF TREEMENU CONTEXT MENU CLICK:

     

     protected void MainMenu_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)

            {

                RadTreeNodeclickedNode = e.Node;

     

                switch(e.MenuItem.Value)

                {

                    case"EditCategory":

                        e.Node.Selected = true;

                        stringtreeViewState = (string)Session["treeViewState"];

                        RadTreeViewcachedTreeView = newRadTreeView();

                        cachedTreeView.LoadXmlString(treeViewState);

     

                        RadTreeNodecachedNodeClicked = cachedTreeView.FindNodeByValue(e.Node.Value);

                    

                        cachedNodeClicked.Expanded = true;

                        cachedNodeClicked.Selected = true;

     

                        Session["treeViewState"] = cachedTreeView.GetXml();

     

                        RadPaneUpPane = (RadPane)this.Page.Master.FindControl("UpPane");

     

                        UpPane.ContentUrl = "EditCategory.aspx?id=" + clickedNode.Attributes["GUID"].ToString();

     

     

                        UpdatePanelupdatePanel1 = (UpdatePanel)this.Page.Master.FindControl("bu");

                        updatePanel1.Update();

                        //Response.Redirect("EditCategory.aspx?id="+ clickedNode.Attributes["GUID"].ToString());

                        break;

     

     

                        RadPaneUpPane = (RadPane)this.Page.Master.FindControl("UpPane");

     

                        UpPane.ContentUrl = "EditCategory.aspx?id=" + clickedNode.Attributes["GUID"].ToString();

     

    Thank you.

     

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Nov 2009 Link to this post

    Hi Aleks,

    I suggest you set ChildrenAsTriggers property of the UpdatePanel to true and the right RadPane will be updated when context menu item is clicked. Please check the attached simple page based on your code.

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