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

Open Radwindow from context menu

3 Answers 130 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Herman
Top achievements
Rank 1
Herman asked on 07 Jun 2011, 08:08 AM
Hi Team

My English is not that good sorry.

I popluate my radtreeview from a sqldatasource works 100%.
Now on the right click contextmenus i want to open a radwindow to add data to sql database to update the treeview nobes

I use this code to open a Radwindow

  RadWindow window1 = new RadWindow();
        window1.NavigateUrl = "frm_Catalogue_Structure.aspx";
        window1.VisibleOnPageLoad = true;
        window1.Width = 400;
        window1.Height = 500;
        this.form1.Controls.Add(window1);








How can i trigger this call from one of the right click contextmenu list
Herman

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Jun 2011, 11:13 AM
Hello Herman,

You can achieve this by attaching ContextMenuItemClick event to the ContextMenu. Hope this helps you.

aspx:
<telerik:RadTreeView runat="server" ID="RadTreeView3"
           oncontextmenuitemclick="RadTreeView3_ContextMenuItemClick">
</telerik:RadTreeView>

C#:
protected void RadTreeView3_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
    {
        RadWindow window1 = new RadWindow();
        window1.NavigateUrl = "frm_Catalogue_Structure.aspx";  
        window1.VisibleOnPageLoad = true;
        window1.Width = 400;
        window1.Height = 500;
        this.form1.Controls.Add(window1);
    }

Thanks,
Princy.
0
Herman
Top achievements
Rank 1
answered on 07 Jun 2011, 12:19 PM
Thanks works 100%
one more thing if i have a contextmenu structure

Brand
          --- Add New Brand
          --- Delete Selected Brand
Catalogue
         --- Add New Catalogue
         --- Delete Selected Catalogue

and i want the radwindow to popup just on the "Add New Catalogue"
0
Veronica
Telerik team
answered on 08 Jun 2011, 09:55 AM
Hi Herman,

You can check whether the text of the RadMenuItem is "Add New Catalogue" and open new window only in that case:

protected void RadTreeView3_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
    {
        if (e.Item.Text == "Add New Catalogue")
        {
            RadWindow window1 = new RadWindow();
            window1.NavigateUrl = "frm_Catalogue_Structure.aspx";   
            window1.VisibleOnPageLoad = true;
            window1.Width = 400;
            window1.Height = 500;
            this.form1.Controls.Add(window1);
       }
    }

Hope this helps.

Kind regards,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
TreeView
Asked by
Herman
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Herman
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or