RadTreeview contextMenu click event

2 posts, 0 answers
  1. Nano
    Nano avatar
    4 posts
    Member since:
    Aug 2012

    Posted 16 Jan 2011 Link to this post

    Hi,
    Can someone please help me with the following issue.

    I am using Frameset in default.aspx page
    <frameset border="0" rows="75,*,10" id="0">
            <frame name="contentmenu" src="<%=menuUrl%>" scrolling="no" noresize="noresize" frameborder="0" />     
            <frameset border="0" cols="284,*" frameborder="0" framespacing="0" runat="server" id="colsFrameset" enableviewstate="false">
                <frame name="contenttree" src="ContentMenu.aspx" scrolling="no" frameborder="0" framespacing="0" border="0" runat="server" id="frameTree" class="TreeFrame" />
                <frame name="contentview" src="../UnderConstruction.aspx" frameborder="0" border="0" framespacing="0" runat="server" id="frameView" />
            </frameset>
            <frame name="contentfooter" src="footer.aspx" scrolling="no" noresize="noresize" frameborder="0" />    
            <noframes>
                <p id="p1">
                    This HTML frameset displays multiple Web pages. To view this frameset, use a
                    Web browser that supports HTML 4.0 and later.
                </p>
            </noframes>
        </frameset>

    in my left frame in ContentMenu.aspx page I have created radtreeview with contextmenu. What I am trying to achieve is when the context menu will be clciked that time time a new page will be create on contentView frame. here is  my leftframe page source....
    <script type="text/javascript">
         //<![CDATA[
         function LoadItem(elementName, elementUrl) {
             parent.frames['contentview'].location.href = elementUrl;
         }

         //]]>
        </script>
    <
    telerik:RadTreeView ID="RadTreeView1" runat="server" CausesValidation="false " OnNodeClick="RadTreeView1_NodeClick"
                       OnContextMenuItemClick="RadTreeView1_ContextMenuItemClick">
                       <ContextMenus>
                           <telerik:RadTreeViewContextMenu ID="RadTreeViewContextMenu1" runat="server">
                               <Items>
                                   <telerik:RadMenuItem runat="server" Text="Add New Page" PostBack="true">
                                   </telerik:RadMenuItem>
                                   <telerik:RadMenuItem runat="server" Text="Remove" PostBack="true">
                                   </telerik:RadMenuItem>
                               </Items>
                           </telerik:RadTreeViewContextMenu>
                       </ContextMenus>
                       <DataBindings>
                           <telerik:RadTreeNodeBinding Expanded="true" />
                       </DataBindings>
                   </telerik:RadTreeView>

    I am trying to call javascript function LoadItem when the contextmenu Item will be clicked. here is my codebehind file.
    protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
            {
                this.NodeText = e.Node.Value;
     
            }
     
    protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
            {
                if (e.MenuItem.Text == "Add New Page")
                {
                    //radpanel1.Visible = true;
                    //txtTile.Text = this.NodeText;
                    e.MenuItem.NavigateUrl = "http://www.google.com";
                    e.MenuItem.Target = "contentview";
                }
                else if (e.MenuItem.Text == "Remove")
                {
                    RadTreeView1.SelectedNode.Remove();
                }
            }

    but its not working. can anyone please help me to make work with calling javascript function with given url .
    Thanks.
  2. Nano
    Nano avatar
    4 posts
    Member since:
    Aug 2012

    Posted 16 Jan 2011 Link to this post

    Hi,
    I have solved the issue. just called javascript function in the following way:
    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tt", "LoadItem('test','http://www.google.com');", true);
    it works.
    Thanks.
Back to Top