Open Radwindow from context menu

4 posts, 0 answers
  1. Herman
    Herman avatar
    2 posts
    Member since:
    May 2011

    Posted 07 Jun 2011 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Jun 2011 Link to this post

    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.
  3. Herman
    Herman avatar
    2 posts
    Member since:
    May 2011

    Posted 07 Jun 2011 Link to this post

    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"
  4. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 08 Jun 2011 Link to this post

    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.

Back to Top