How to refresh parent window without closing popup

7 posts, 0 answers
  1. Nirav
    Nirav avatar
    48 posts
    Member since:
    Sep 2008

    Posted 22 Dec 2010 Link to this post

    Hi,
    I have a webform where on one of the button click, I have to pop up another form, and on that pop up form, whatever user selects, need to add to the parent form grid. Now I am able to update parent page grid by calling parent page code behind function but the problem is that after that function call, the pop up screen is closed even though I dont have any code to close it down.

    So simply, on my pop up page, I am storing something on session, on one of its button click, I am calling function to execute parent page's code behind function, ACTUALLY I am calling one of the button's click event. Everything works fine except the Pop up window close down after I call this function and I donot want it to be closed. I want to refresh parent grid and want to keep pop up window open.
    Any suggestion ?
    Here is my code. Although I copied it almost from telerik samples, please do let me know what changes do I need to make in order to keep the pop up open even after parent page's function is called.

    #########################################################################################################
    -- SCRIPTS OF PARENT PAGE
      
    function OpenPopup(currentVersion) {
                var widthVal = 750;
                var heightVal = 700;
      
                var oWnd = radopen("Components.aspx?v=" + currentVersion, "RadWindow1");
               oWnd.setSize(heightVal, widthVal);
               //set a function to be called when RadWindow is closed
               oWnd.add_close(OnClientClose);
               return false;
         }
      
      
    function OnClientClose(oWnd) {
         //get the transferred arguments
         document.getElementById("btnSearchComponent").click();
         }
      
    function CalledFn() {
         document.getElementById("btnSearchComponent").click();
         }
      
      
      
         <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
         ReloadOnShow="true" ShowContentDuringLoad="false" Skin="Default" 
         KeepInScreenBounds ="true" VisibleStatusbar="false" >
         <windows>
         <telerik:RadWindow runat="server" ID="RadWindow1" Width="800" Height="500" Behaviors="Move,Close" 
         Modal="true" NavigateUrl="Components.aspx" AutoSize="false"  
         OnClientClose="OnClientClose" >
         </telerik:RadWindow>
         </windows>                     
         </telerik:RadWindowManager>
      
      
      
    ON MY POP UP PAGE ( CHILD PAGE )
      
     <script language="javascript" type="text/javascript">
      
         function CloseForm() {
             window.opener.document.getElementById("btnSearchComponent").click();
         }
     </script>    
      
                    <asp:Button runat="server" ID="btnAddProduct" Text="Add" 
                        CssClass="ButtonCSS" onclick="btnAddProduct_Click" Width="350px" />
      
    CODE BEHIND TO CALL ABOVE FUNCTION AFTER PERFORMING CERTAIN TASKS AND TO STORE MY VALUES IN SESSION
     protected void btnAddProduct_Click(object sender, EventArgs e)
     {
    // I PERFORM CERTAIN TASKS HERE
    ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript", @"<script>CloseForm();</script>");
    }

    #########################################################################################################
    Thanks in advance,
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 23 Dec 2010 Link to this post

    Hi Nirav,

    In your case, I suggest to examine this demo. In it, we call (from within the content page) a JavaScript function on the main page, that uses RadAjaxManager's ajaxRequest() to rebind the RadGrid on the main page.

    Kind regards,
    Georgi Tunev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Nirav
    Nirav avatar
    48 posts
    Member since:
    Sep 2008

    Posted 23 Dec 2010 Link to this post

    Thanks for your reply Admin.

    Actually in this demo also it closes down the pop up form. What I am looking for is that it keeps the pop up form open as it is, but refreshes the parent page's grid or call some of the javascript function of the parent page where I can call code behind to refresh parent page grid.
    But the pop up form should not be closed.

    If you see my code, I am able to call parent page's javascript function inwhich I am calling code behind to refresh grid. That works but the problem is that pop up form is getting closed. So is there any other way around where pop up page stays opened as it is and parent page's grid can get refreshed?

    Also I tried the code given in demo and have one confusion. I tried to call parent page's function by calling "GetRadWindow().BrowserWindow.refreshGrid("Rebind");" but didnt execute function. so where in this demo is the code to call parent page's function?

    Any sugguestion?

    Thanks again,
    Nirav



  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 24 Dec 2010 Link to this post

    Hello Nirav,

     You will get exactly what you need based on the demo my colleague pointed - the only thing you should change is to remove the following line:

    RadWindow's content page:

    function CloseAndRebind(args) {
            GetRadWindow().BrowserWindow.refreshGrid(args);
            // - remove this -GetRadWindow().close();
        }

    This line is the one which closes the RadWindow and if you remove it, it will stay opened due to the fact that AJAX is used to refresh the parent page.

    On a side note, when you install RadControls, our online examples projects are automatically installed on your computer and you can not only examine their full source code, but also extend them further in order to meet your requirements.

    You can open the demos from here:

    Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio

    The actual location on your hard disk is the following one:

    C:\Program Files\Telerik\RadControls for ASPNET AJAX \Live Demos

    I hope that this information is helpful, let me know how it goes.

    Best wishes,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  5. Nirav
    Nirav avatar
    48 posts
    Member since:
    Sep 2008

    Posted 30 Dec 2010 Link to this post

    Hi admin,

    I dont have any code where I am calling to close radwindow.
    Actually I am always following Tekerik Examples which really are having all the possible scenarios.

    And with this code, I am just calling a Function of Parent page, I do not call any function to close form but still after it calls Parent Page's function, it closes down.

    I will create a sample project and will upload here for this. So that you can check.

    Thanks,
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 03 Jan 2011 Link to this post

    OK Nirav,

    We will be expecting your support ticket.

    All the best,
    Georgi Tunev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  7. Anand
    Anand avatar
    10 posts
    Member since:
    Mar 2014

    Posted 02 Dec 2017 Link to this post

    Hi Nirav, Georgi Tunev 

    Did you get any solution for this issue, I am also facing the same issue.

    Kindly assist me.

     

    Thanks,

    Anand

     

     

Back to Top