Menu built in code behind doesnt activate with KeyboardNavigationSettings key

2 posts, 0 answers
  1. david
    david avatar
    238 posts
    Member since:
    May 2007

    Posted 10 Oct Link to this post

    See the code below, the RadMenu1 ALT-M works but the RadMenu2 ALT-N does not? So I'm guessing we need to set the RadMenu2 RadMenu2.KeyboardNavigationSettings.FocusKey in the code behind but RadMenu2.KeyboardNavigationSettings.FocusKey="N" is an error, how do we set this property?

      <telerik:RadMenu ID="RadMenu1" runat="server" BorderWidth="1px"
                    Style="z-index: 10; width: 100%; white-space: normal;" Skin="Silk"
                    Font-Names="Verdana" Font-Size="X-Small" EnableRoundedCorners="True"
                    EnableAriaSupport="True">
                    <Items>
                        <telerik:RadMenuItem runat="server" AccessKey="1" Text="Unit 1">
                            <Items>
                                <telerik:RadMenuItem runat="server" AccessKey="O" Text="open">
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem runat="server" AccessKey="C" Text="Close">
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" AccessKey="2" Text="Unit 2">
                            <Items>
                                <telerik:RadMenuItem runat="server" AccessKey="A" Text="Lec A">
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem runat="server" AccessKey="B" Text="Lec B">
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadMenuItem>
                    </Items>
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

                    <KeyboardNavigationSettings CommandKey="Alt" FocusKey="M"></KeyboardNavigationSettings>
                </telerik:RadMenu>

                <telerik:RadMenu ID="RadMenu2" runat="server" Flow="Horizontal" BorderWidth="1px"
                    Style="z-index: 10; width: 100%; white-space: normal;" Skin="Silk"
                    Font-Names="Verdana" Font-Size="X-Small" EnableRoundedCorners="true" RenderMode="Lightweight"
                    EnableAriaSupport="true">
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                    <KeyboardNavigationSettings CommandKey="Alt" FocusKey="N"></KeyboardNavigationSettings>
                </telerik:RadMenu>

     

     protected void Page_Load(object sender, EventArgs e)
        {
            RadMenuItem m = new RadMenuItem();
            m.Text = "Menu 1";
            RadMenu2.Items.Add(m);
            m.Text = "Menu 2";
            RadMenu2.Items.Add(m);
            //RadMenu2.KeyboardNavigationSettings.FocusKey = "";
            //RadMenu2.KeyboardNavigationSettings.CommandKey = "Alt";
        }

  2. david
    david avatar
    238 posts
    Member since:
    May 2007

    Posted 10 Oct Link to this post

    solved

     

     RadMenu2.KeyboardNavigationSettings.FocusKey = KeyboardNavigationKey.N;
            RadMenu2.KeyboardNavigationSettings.CommandKey = KeyboardNavigationModifier.Alt;

Back to Top