RadMenu still active when RadAlert is displayed

3 posts, 1 answers
  1. Matt
    Matt avatar
    33 posts
    Member since:
    Nov 2010

    Posted 09 Nov 2011 Link to this post

    Hello,

    We have created a web page that uses a RadMenu as a means of navigation. We also use the RadAlert to display message to the user. However, when the RadAlert window is display (and the parent page is disabled) the RadMenu control is still accessible. 
    ASPX code:
    <telerik:RadWindowManager ID="WindowManager" runat="server" />
    <
    table >
        <tr>
            <td  valign="top">
                <telerik:RadMenu ID="RadMenu1" Runat="server" Flow="Vertical">
                    <Items>
                        <telerik:RadMenuItem Text="item 1">
                            <Items>
                                <telerik:RadMenuItem Text="sub 1 1" />
                                <telerik:RadMenuItem Text="sub 1 2" />
                                <telerik:RadMenuItem Text="sub 1 3" />
                            </Items>
                        </telerik:RadMenuItem>
                     
                        <telerik:RadMenuItem Text="item 2">
                            <Items>
                                <telerik:RadMenuItem Text="sub 2 1" />
                                <telerik:RadMenuItem Text="sub 2 2" />
                                <telerik:RadMenuItem Text="sub 2 3" />
                            </Items>
                        </telerik:RadMenuItem>
                         
                        <telerik:RadMenuItem Text="item 3">
                            <Items>
                                <telerik:RadMenuItem Text="sub 3 1" />
                                <telerik:RadMenuItem Text="sub 3 2" />
                                <telerik:RadMenuItem Text="sub 3 3" />
                            </Items>
                        </telerik:RadMenuItem>
                    </Items>
                 
                </telerik:RadMenu>
            </td>
            <td valign="top">
                stuff<br />
                <asp:Button ID="btnAlert" runat="server" Text="Alert"
                    onclick="btnAlert_Click" />
            </td>
        </tr>
    </table>
    C# code:
    /// <summary>
    /// Recursively searches for a control with the specified ID.
    /// </summary>
    protected Control FindControl(Control control, string id)
    {
        Control foundControl = control.FindControl(id);
     
        if (foundControl == null)
        {
            for (int index = 0; index < control.Controls.Count; index++)
            {
                Control childControl = control.Controls[index];
     
                foundControl = FindControl(childControl, id);
     
                if (foundControl != null)
                {
                    break;
                }
            }
        }
     
        return foundControl;
    }
     
    protected void btnAlert_Click(object sender, EventArgs e)
    {
        RadWindowManager windowManager =
               FindControl(this, "WindowManager") as RadWindowManager;
     
        if (windowManager != null)
        {
            windowManager.RadAlert("message", 400, null, "title", null);
        }
    }

    I've tried setting RadMenu1.Enabled = false; before the RadAlert() is called (which works), but the RadMenu does not look correct. The z order of the RadMenu is still above everything else.

    Does anybody know how to disable the RadMenu when the RadAlert window is displayed (and enable the RadMenu when the RadAlert window is closed)?

    Thanks,

    Matt
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Nov 2011 Link to this post

    Hello Matt,

    Try to set a higher z-index for RadWindowManager and lower for RadMenu which worked as expected. Here is the sample code.

    ASPX:
    <telerik:RadWindowManager ID="WindowManager" runat="server" Modal="true" EnableViewState="true" Overlay="true" CssClass="windowcss" />
     <telerik:RadMenu ID="RadMenu1" Runat="server" Flow="Vertical" CssClass ="menucss">
      <Items>
        ....
      </Items>
    </telerik:RadMenu>

    CSS:
    <style type="text/css">
        .windowcss
        {
            z-index:7000 ! important;
        }
        .menucss
        {
            z-index:200 ! important;
        }
    </style>

    Thanks,
    Princy.
  3. Matt
    Matt avatar
    33 posts
    Member since:
    Nov 2010

    Posted 09 Nov 2011 Link to this post

    cheers Princy, that's a fix!
Back to Top