prevent RadConfirm from moving outside the page

2 posts, 0 answers
  1. Savidu
    Savidu avatar
    3 posts
    Member since:
    Mar 2012

    Posted 05 Jul 2012 Link to this post

    Hi

    I have created a custom template for the radwindows radconfirm dialogue as follows

    <telerik:RadWindowManager ID="RadWindowManager2" runat="server" VisibleTitlebar="false" MaxHeight="50px" KeepInScreenBounds="true " Behaviors="None" Skin="Telerik">
            <ConfirmTemplate >       
            <div class="rwDialogPopup radconfirm">
                <div class="rwDialogText">
                    {1}
                </div>
                <div>
                    <a onclick="$find('{0}').close(true);" class="rwPopupButton" href="javascript:void(0);">
                        <span class="rwOuterSpan"><span class="rwInnerSpan"><%= Localization.GetString("OKConfirm.Text", this.LocalResourceFile)%></span></span></a>
                    <a onclick="$find('{0}').close(false);" class="rwPopupButton" href="javascript:void(0);">
                        <span class="rwOuterSpan"><span class="rwInnerSpan"><%= Localization.GetString("CancelConfirm.Text", this.LocalResourceFile)%></span></span></a>
                </div>
            </div>
             
             
            </ConfirmTemplate>
        </telerik:RadWindowManager>
     this works fine where i get the localized text for Ok and cancel buttons.

    However the issue is that the radconfirm box is draggable out of the screen area there by giveing scrolls nto the page. As show in the image.

    How can i prevent this.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 06 Jul 2012 Link to this post

    Hi Savidu,

    You cannot prevent the user from dragging an object outside of the original viewport area. You can, however, set the KeepInScreenBounds property of the RadWindowManager to true so that the RadConfirm returns in the visible viewport once the user releases the mouse button. An alternative is also to disable its Move behavior. This can be done via JavaScript after you call it because the radconfirm() function returns a RadWIndow reference, so you can do something like:
    var oConfirm = radconfirm("sure?", callbackFn);
    oConfirm.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);//leaves only the Close behavior



    All the best,
    Marin Bratanov
    the Telerik team
    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 their blog feed now.
Back to Top