Previously selected MenuItem not losing focus

9 posts, 0 answers
  1. Priyank
    Priyank avatar
    13 posts
    Member since:
    Nov 2013

    Posted 21 Nov 2013 Link to this post

    Hi,

    On click of one of the RadMenuItems, I'm opening Radwindow to display another page, whereas other Menu items redirect user to different page. The issue I'm facing is when I click on that Menuitem to open RadWindow, previously selected MenuItem still remains highlighted.
    As a result it shows both menu items highlighted. 

    Let me know how I can fix this.

    Thanks,
    Priyank
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2013 Link to this post

    Hi Priyank,

    Please have a look into the sample code which works fine at my end.

    ASPX:
    <telerik:RadMenu ID="RadMenu1" runat="server" ClickToOpen="true" OnItemClick="RadMenu1_ItemClick">
        <Items>
            <telerik:RadMenuItem Text="Page1" runat="server" NavigateUrl="Alignment.aspx" Selected="true">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Text="OpenRadwindow" runat="server">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Text="Page2" runat="server" NavigateUrl="AddItemClientSide.aspx">
            </telerik:RadMenuItem>
        </Items>
    </telerik:RadMenu>

    C#:
    protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
    {
        if (e.Item.Text == "OpenRadwindow")
        {
            RadWindow window = new RadWindow();
            window.VisibleOnPageLoad = true;
            form1.Controls.Add(window);
        }
    }

    Please provide your code if it doesn't help.
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Priyank
    Priyank avatar
    13 posts
    Member since:
    Nov 2013

    Posted 22 Nov 2013 Link to this post

    Hi Shinu,

    My code is very much similar to yours. The only difference is I'm adding Rad window to Rad window manager rather than form.

    My Html code is like this:
     
    <telerik:RadMenu ID="RadMenuActions" runat="server" SkinID="RadMenu" Flow="Vertical"
                                 OnItemClick="RadMenuActions_ItemClick">
                    <Items>
                        <telerik:RadMenuItem runat="server" SkinID="RadMenuItem" AccessKey="O" Text="Ordering"
                                             NavigateUrl="~/Domains/Items/ItemOrder/Default.aspx">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" SkinID="RadMenuItem" AccessKey="e" Text="Receiving"
                                             NavigateUrl="~/Domains/Items/ItemReceive/Default.aspx">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" SkinID="RadMenuItem" AccessKey="s" Text="Vendor Returns"
                                             NavigateUrl="~/Domains/Items/VendorReturn/SearchReturns.aspx">
                        </telerik:RadMenuItem>
                        
                        <telerik:RadMenuItem runat="server" SkinID="RadMenuItem" AccessKey="w" Text="Add New Item"
                                             Value="Add New Item">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" SkinID="RadMenuItem" AccessKey="M" Text="Manage Item List"
                                             Value="Manage Item List">
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
                <telerik:RadWindowManager ID="PartAddRadWindowManager" runat="server">
                </telerik:RadWindowManager>
     
    C# code:
     
     protected void RadMenuActions_ItemClick(object sender, RadMenuEventArgs e)
        {
            switch (e.Item.Value)
            {
                case "Add New Item":
                    RadWindow window = new RadWindow();
                    window.ID = "ItemAddRadWindow";
                    window.Width = 600;
                    window.Height = 500;
                    window.NavigateUrl = @"~/Domains/Items/CreateItem/ItemAdd.aspx";
                    window.VisibleOnPageLoad = true;
                    window.Modal = true;
                    //window.Skin = "Sunset";
                    window.Behaviors = WindowBehaviors.Close | WindowBehaviors.Move;
                    PartAddRadWindowManager.Windows.Clear();
                    PartAddRadWindowManager.Windows.Add(window);
                    break;
                 case "Manage Item List":
                    Response.Redirect(@"~/Domains/Items/ItemList/Default.aspx");
                    break;
               
            }
            
        }

    Thanks,
    Priyank
  5. Priyank
    Priyank avatar
    13 posts
    Member since:
    Nov 2013

    Posted 26 Nov 2013 Link to this post

    Hi,

    Could someone from telerik support team help me out with this?

    I have been trying hard for past 2 days, but haven't found any work around for this.

    I have placed the RadMenu in Usercontrol and this user control is placed in a master page.

    Thanks,
    Priyank
  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 26 Nov 2013 Link to this post

    Hello Priyank,

    Please try to deselect the clicked RadMenu item as shown in the code snippet below. The suggested line of code is marked in yellow color at the bottom of the code snippet.
    //code behind
    protected void RadMenuActions_ItemClick(object sender, RadMenuEventArgs e)
        {
            switch (e.Item.Value)
            {
                case "Add New Item":
                    RadWindow window = new RadWindow();
                    window.ID = "ItemAddRadWindow";
                    window.Width = 600;
                    window.Height = 500;
                    window.NavigateUrl = @"~/Domains/Items/CreateItem/ItemAdd.aspx";
                    window.VisibleOnPageLoad = true;
                    window.Modal = true;
                    //window.Skin = "Sunset";
                    window.Behaviors = WindowBehaviors.Close | WindowBehaviors.Move;
                    PartAddRadWindowManager.Windows.Clear();
                    PartAddRadWindowManager.Windows.Add(window);
                    break;
                 
     
            }
            e.Item.Selected = false;
        }



    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Priyank
    Priyank avatar
    13 posts
    Member since:
    Nov 2013

    Posted 26 Nov 2013 Link to this post

    Hi Boyan,

    This line of code deselects the Rad menu item which is clicked. But my problem is I want to deselect previously selected menu item, not the currently clicked item.

    Is there a way to do this?

    Thanks,
    Priyank
  8. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 29 Nov 2013 Link to this post

    Hello,

    An easy and convenient way of achieving such functionality would be when user clicks/selects an item to store that item's text or value so you can find that item and deselect the item as shown in my very last response. Another approach would be get all items and check whether some item is selected to deselect it.


    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  9. Angelo
    Angelo avatar
    1 posts
    Member since:
    Apr 2016

    Posted 28 Apr in reply to Boyan Dimitrov Link to this post

    I am having the same problem.  I have tried several things (i.e. setting focus).  Nothing seams to work.  Please give examples on how to do this on client and server sides.
  10. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 02 May Link to this post

    Hi,

    The forum is quite old so would you please elaborate a little bit the exact code that you are suing so we could be more helpful with a possible solution.

    Regards,
    Plamen
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017