ReBinding Grid on ParentPage on Close of RadWindow

2 posts, 0 answers
  1. Anthony
    Anthony avatar
    26 posts
    Member since:
    Mar 2009

    Posted 22 May 2012 Link to this post

    Hi Guys hope someone can help, i know this is covered in another thread but im having an issue with the radwindow and rebinding the grid on my parent page.

    I have a RadWindow that i open when i click a button on the ParentPage, the window opens as a modal window i am using thos to have a document upload on the new window.  Once the document is uploaded i want the user to be able to click a close button on the radwindow and this close the window and rebind my grid on my parent page.

    When my radWindow opens it is modal as the background is greyed out,once i have uploaded a document when i click my close button which is Button1 in this case , the window closes rebinds the grid as i want it to but then the radwindow opens again but not in a modal state and i am unable to close it.

    Javascript on my parent page is 
    <script type="text/javascript">
            function openWin() {
                var value = '<%=MeetingID %>';
                var oWnd = radopen("DocumentUpload.aspx?MeetingID=" + value, "WindowDocumentUpload");
            function getRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            function refreshGrid(arg) {
                if (!arg) {
                    $find("<%= RadAjaxManagerCreateMeeting.ClientID %>").ajaxRequest("Rebind");
                else {
                    $find("<%= RadAjaxManagerCreateMeeting.ClientID %>").ajaxRequest("RebindAndNavigate");
            function OnClientFileOpen(oExplorer, args) {
                //get the extension of the opened item
                //            var item = args.get_item();
                //            var fileExt = args.get_item().get_extension();
                //            if (fileExt == "xlsx" || fileExt == "docx") {
                //                args.set_cancel(true);
                //                var requestImage = "FileSystemHandler.ashx?path=" + item.get_url();
                //                document.location = requestImage;
                //            }
                //if (fileExt && fileExt.toLowerCase() == "pdf") {
                //cancel the default behavior
                //open new RadWindow
                var oWnd = radopen(args.get_item().get_path(), "RadWindow1");
                //set size to the newly opened RadWindow
                oWnd.setSize(850, 500);
                //if you want to open the PDF file in a new browser window
                //you can use the following code
                //    }

    Javascript in my radwindow page is 
    <script type="text/javascript">
                  function CloseAndRebind(args) {
                  function GetRadWindow() {
                      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)
                      return oWindow;
                  function CancelEdit() {

    Then the VB in my Radwindow Page is 

    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", True)
      End Sub

    Hope you can help 

  2. Marin Bratanov
    Marin Bratanov avatar
    5812 posts

    Posted 24 May 2012 Link to this post

    Hi Anthony,

    This code seem ok and the reason for this behavior may be somewhere in the server handler for the AJAX request - e.g. a call to a JavaScript function that opens a RadWindow without the necessary properties set. It is also possible that it originates in code you have not pasted here, as I currently do not know what your RadWindow declaration is.

    Such an unresponsive RadWindow is usually due to calls to methods like center(), moveTo() or setSize() on a closed RadWindow, as they repaint the popup element and show it, but the handlers for the close button are not attached in these functions. I would, therefore, advise that you examine your event handlers and the rest of your code for similar calls. You can locate the problem by stripping out code piece by piece until the problem goes away so you can pinpoint its location.

    Kind regards,
    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