Window is not closing via custom button

2 posts, 0 answers
  1. rick
    rick avatar
    1 posts
    Member since:
    Oct 2010

    Posted 05 Oct 2010 Link to this post

    I have a web page and it has one textbox and button. User can enter specific url to textbox and clicking button opens a new telerik window. This popup window has cancel button and clicking that button close the window.

    For example: When user navigates http://server1/testpage.aspx then user enters http://server1/newpopup.aspx then clicks open button and popup shows up then user clicks cancel button on the newpopup.aspx page window closes. When user types http://server2/newpopup.aspx popup shows up but clicking cancel button does not close the newpopup window and it gives access denied error message. This is not a cross browsing issue because I am trying to close popup window in the popup window control.

    //Open popup
            protected void xcBrowseDes_Click(object sender, EventArgs e)
                string destinationURL = txtDESTURL.Text.ToLower().Trim().TrimEnd(new char[] { '/' });
                ScriptManager.RegisterStartupScript(xcBrowseDes, typeof(string), "alertScript1", "Confirm('" + destinationURL+"');",true);

    function Confirm(par) {

                var oWnd = radopen(par, "Browse");
                var width = $(window).width();
                if (width > 750)
                    width = 750;

                oWnd.setSize(width - 15, $(window).height() - 15); 

    //javascript closing popup window
      function GetRadWindowClose() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog 
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well) 


    I also tried just window.close() javascript method or self.close() but both methods did not close the window.

  2. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 08 Oct 2010 Link to this post

    Hi Rick,

    If the context page (newpopup.aspx) comes from a different domain, the error is expected as you cannot access objects from the parent page from within the parent page. The issue is not related to the RadWindow control - you can try getting an access to another JS object in the parent and you will receive the same access denied message. To avoid that, you could try to use document.domain to set the domain property of the document object to the domain of the other page.

    Sincerely yours,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top