This is a migrated thread and some comments may be shown as answers.

RadMenu still active when RadAlert is displayed

2 Answers 71 Views
Window
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 09 Nov 2011, 11:14 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Nov 2011, 12:10 PM
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.
0
Matt
Top achievements
Rank 1
answered on 09 Nov 2011, 12:33 PM
cheers Princy, that's a fix!
Tags
Window
Asked by
Matt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Matt
Top achievements
Rank 1
Share this question
or