When Rad Window closed or user moves away from the window , need to show alert message Are you sure want to leave?

2 posts, 0 answers
  1. Joselina
    Joselina avatar
    16 posts
    Member since:
    Nov 2013

    Posted 28 Feb 2014 Link to this post

    Hi,

    I am opening a page to add some document data through a window, and i need to popup the alert "Are you sure want to leave this page?" when ever the user close this window or moves the cursor away from the window or clicks anywhere else other than window. Can you please help me how to show this alert message?
    1.This window opens up by clicking the sub menu items from the menu items list. 
    2. I want to show this alert only when i click the Add menu item -> Submenu items
    3.I should not show the alert when i click Replace or any other menu items in that menu list.
    4. Onemore thing this page already has the below Alert function and it is working fine when I am opening the same page in different location in a normal way but not in window mode.
    This is the Javascript Function for the Alert
     
    function windowOnBeforeUnload() {
     
            if (window.event)
                window.event.returnValue = 'You will lose any unsaved changes!'; // IE
            else
                return 'You will lose any unsaved changes!'; // FX
        }
     
    This is the RadMenu HTML code
    <table class="takeActionTableContainer" cellpadding="1" cellspacing="0" style="margin: 0 auto;">
        <tr>
            <td style="vertical-align:top; text-align:center; width:50%">
                <telerik:RadMenu ID="RadMenuLibrary" runat="server" EnableRoundedCorners="true" EnableShadows="true" Skin="Default" EnableTextHTMLEncoding="true" Width="100%"
                    style="z-index:10; position: relative; margin: 0; text-align:center;" DefaultClickToOpen="False" CollapseDelay="200" ExpandDelay="200" OnClientItemClicked="OnTakeActionItemClicked" OnClientItemClosed="windowOnBeforeUnload" OnClientMouseOut="windowOnBeforeUnload" >
                    <ExpandAnimation Type="None" Duration="200" />
                    <CollapseAnimation Type="None" Duration="200" />
                    <Items>
                        <telerik:RadMenuItem runat="server" Text="LIBRARY" PostBack="false" Width="100%"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
            </td>
            <td style="vertical-align:top; text-align:center; width:50%">
                <telerik:RadMenu ID="RadMenuCollaborator" runat="server" EnableRoundedCorners="true" EnableShadows="true" Skin="Default" EnableTextHTMLEncoding="true" Width="100%"
                    style="z-index:10; position: relative; margin: 0; text-align:center;" DefaultClickToOpen="False" CollapseDelay="200" ExpandDelay="200" OnClientItemClicked="OnTakeActionItemClicked" >     
                    <ExpandAnimation Type="None" Duration="200" />
                    <CollapseAnimation Type="None" Duration="200" />
                     <Items>
                        <telerik:RadMenuItem runat="server" Text="COLLABORATOR" PostBack="false" Width="100%"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
            </td>
        </tr>

    I have called the alert function in OnClientItemClicked but i dont want this alert to be displayed when other menu items are clicked.

    Thanks
    Joselina
  2. Joselina
    Joselina avatar
    16 posts
    Member since:
    Nov 2013

    Posted 28 Feb 2014 in reply to Joselina Link to this post

    sorry not in onclientclicked , but i called in OnClientItemClosed="windowOnBeforeUnload" OnClientMouseOut="windowOnBeforeUnload"
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top