Radwindow popup

3 posts, 1 answers
  1. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 28 Jun 2013 Link to this post

    I have a radgrid. It has edit enabled only for first row.
    When the edit is clicked it opens a new radwindow to collect additional information.
    Also the radgrid allows row drag and drop.
    On rowdrop it checks if the new position is going to be first row it opens the new window to collect similar data for the new first row.
    Now when the row is edited and then if the row is dragged and droped two windows open.
    If we drag one more time three windows open.
    Tried a few things like 
    _menuwindow.DestroyOnClose = true;
    But doesn't help.

    Please help. How can I avoid opening unneccessary windows?
    If I debug the code it doesn't really go to server to open the serverside window again.
    I identify the two windows by giving different names server side and client side.

    Any help is appreciated.
    Thanks in advance.

    Here is the code :

     protected void UIProceduresGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
            GridDataItem gdItem = e.Item as GridDataItem;

            if (gdItem != null)
                if (e.CommandName == "PDFEdit")
                    RadWindow _menuwindow = new RadWindow();
                    _menuwindow.NavigateUrl = "ProcedureDependantFactors.aspx";
                    _menuwindow.VisibleOnPageLoad = true;
                    _menuwindow.ShowContentDuringLoad = true;
                    _menuwindow.Style.Value = "z-index:7010;";
                    _menuwindow.ID = "ProcedureDependantFactors";                
                    _menuwindow.Modal = true;
                    _menuwindow.Height = 400;
                    _menuwindow.Width = 900;
                    _menuwindow.Title = "Procedure Dependant Factors Serverside";
                    _menuwindow.DestroyOnClose = true;
                   // _menuwindow.OnClientClose = "RefreshParentPage();";

    function OnProcRowDropping(src, args) {
        //alert("Dragged grid row index is: " + args._dragedItems[0]._itemIndexHierarchical + "   Dropped target element index is: " + args._targetItemIndexHierarchical + "   Position : " + args._dropPosition);
        if (args._targetItemIndexHierarchical == 0 && args._dropPosition == 'above') {
            if (!confirm('There is another record marked as primary that record will no longer be primary. And the dependant records will be deleted. Are you sure you want to proceed?')) {
            else {

    function ShowPDF() {
        var oManager = window.radopen("ProcedureDependantFactors.aspx");
        oManager.DestroyOnClose = true;
        oManager.Title = "Procedure Dependant Factors Clientside";

  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    3564 posts

    Posted 02 Jul 2013 Link to this post

    Hello Gauri,

    On opening a RadWindow from the server I strongly advise that you use the approach from this sticky thread: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx and that the same RadWindow is used in both cases. When you create a new instance and add it to the Windows collection of the manager it is persisted accross postbacks and the VisibleOnPageLOad property makes it show up after each postback. Also, the client-side event handlers of our controls only need the name of the JS function, without the parentheses, as explained in this blog post.

    The ShowPDF() function creates a new RadWindow instance and in order to set its destroyOnClose property to true you need the set_destroyOnClose(true) method from the control's client-side API. You can call the same function from the code-behind.

    You can even add a check through the RadWindowManager API - designate a name for the popup (the second argument to open(), as explained here) and from the manager getWindowByName() and then its isVisible() property - if it is already visible simply abort the function, show it only otherwise. Note that if radopen() or wndManager.open() are used first the call to .show() is not needed, else the show() call must come before the rest of the API is used. If you take this approach you can declare the desired properties of the popup in the markup and avoid the DestroyOnClose property. This will also allow you to avoid duplicate popups and, if suitable for your case, even avoid the postback that otherwise opened the popup.

    Marin Bratanov
    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 the blog feed now.
  3. DevCraft R3 2016 release webinar banner
  4. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 03 Jul 2013 Link to this post

    Thanks Marin. That solved my problem.
Back to Top