RadMenuItem

5 posts, 0 answers
  1. Samee Mir
    Samee Mir avatar
    26 posts
    Member since:
    Jan 2010

    Posted 19 Jan 2010 Link to this post

    hi

    Telerik.Web.UI.

     

    RadMenuItem item = new Telerik.Web.UI.RadMenuItem("New Menu", "~/LlbTest.aspx");
    i want to open a popup window at the place of url can you please tell me how to do this.
    regards
    Samee Javaid

     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Jan 2010 Link to this post

    Hi Samee,

    You can open the radwindow from client code in the OnClientItemCliking event of menu. And cancel the click event to prevent the page to redirect according to Navigateurl set for the item.

    JavaScript:
     
    <script type="text/javascript"
        function OnClientItemClicking(sender, args) { 
            var url = args.get_item().get_navigateUrl(); 
            var ownd = radopen(url); 
            args.set_cancel(true); // Cancel the event 
        } 
    </script> 

    -Shinu.
  3. Samee Mir
    Samee Mir avatar
    26 posts
    Member since:
    Jan 2010

    Posted 20 Jan 2010 Link to this post

    hi,
    thnx shinu ...
    there is a problem, i m using radfileExplorer and have to use its radGridContextMenu I cant use new radMenu
    here is my code kindly check it

    Telerik.Web.UI.

     

    RadMenuItem item = new Telerik.Web.UI.RadMenuItem("New Menu");

     

    RadFileExplorer1.GridContextMenu.Items.Add(item);

    so is there any way i can use java script with GridContextMenu

    regards,
    Samee Javaid

  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 22 Jan 2010 Link to this post

    Hi Samee,

    You can add items attach handler to the GridContextMenu object of RadFileExplorer by using this approach:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadMenuItem menuItem = new RadMenuItem("Open telerik.com", "http://www.telerik.com");
        RadFileExplorer1.GridContextMenu.Items.Add(menuItem);
        RadFileExplorer1.GridContextMenu.OnClientItemClicking = "OnGridContextMenuItemClicking";
    }

    For your convenience I have placed an example implementation of the OnGridContextMenuItemClicking handler:

    <script type="text/javascript">
        function OnGridContextMenuItemClicking(oContextMenu, args)
        {
            // Whether a new window to be opened or not
            var isNewWndowRequired = true;
            if (isNewWndowRequired)
            {
                args.set_cancel(true);
                oContextMenu.hide();
                var menuItem = args.get_item();
                var navigateUrl = menuItem.get_navigateUrl();
                radopen(navigateUrl, null);
            }
            else
            {
                // Open the www.telerik.com in the same page;
            }
        }
    </script>


    I hope this helps.

    All the best,
    Fiko
    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. Samee Mir
    Samee Mir avatar
    26 posts
    Member since:
    Jan 2010

    Posted 22 Jan 2010 Link to this post

    thanks..it works.:)    
Back to Top