Refreshing the parent control without closing Rad Window

4 posts, 0 answers
  1. Saurabh
    Saurabh avatar
    12 posts
    Member since:
    Mar 2012

    Posted 22 Mar 2012 Link to this post

    Hi ,
    I am using RadWindowManager in my application , I need to send a argument from the Window to its parent Control.I am adding the records form Rad Window which are displayed on its parent control , when i hit a particular button i need to refresh the parent so that the records get updated in the parent control without closing the Rad Window..

    Can some one help me on this?

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Mar 2012 Link to this post

    Hello Saurabh,

    I have tried the scenario with this demo. Find the sample code pasted in the post:
    <head runat="server">
            <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() {
        <form id="form1" runat="server">
        <asp:TextBox ID="FirstName" runat="server"></asp:TextBox><br />
         LatName:  <asp:TextBox ID="LatName" runat="server"></asp:TextBox><br />
         Title: <asp:TextBox ID="Title" runat="server"></asp:TextBox>
        <br />
        <asp:Button Text="Insert" runat="server" ID="btnInsert" onclick="btnInsert_Click" />
        <asp:Button Text="Cancel" runat="server" ID="btnCancel" onclick="btnCancel_Click" />

    public partial class rADgRID_InsertForm : System.Web.UI.Page
        public SqlCommand SqlCommand = new SqlCommand();
        protected void btnInsert_Click(object sender, EventArgs e)
            String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(ConnString);
            string insertQuery = "INSERT into  Employee(FirstName,LastName,Title) values('" + FirstName.Text + "','" + LatName.Text + "','" + Title.Text + "')";
            SqlCommand.CommandText = insertQuery;
            SqlCommand.Connection = conn;
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
        protected void btnCancel_Click(object sender, EventArgs e)
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);

  3. Saurabh
    Saurabh avatar
    12 posts
    Member since:
    Mar 2012

    Posted 23 Mar 2012 Link to this post

    I tried it already  . Also saw the demo link also sent in the reply in the demo Grid is refreshing on closing window,. But we need to refresh Grid without closing the window.


    Parent window is  Perent.ascx which is having the java script PopUpFutureObligationCallBack (){} and window manger to open popup page  . On Child.aspx page there is a Button SaveAndAddNew when we click on button the data will submit and Grid existing in Perent.ascx should be refresh without closing

    The Popup child.aspx

    In this case I  tried to call the java script on parent page but I am unable to do that.

    I tried the code

    Script in perent window PopUpFutureObligationCallBack(){}



    Protected Sub SaveAndAddNew _Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveAndAddNew.Click


    Dim refreshopener As String

     refreshopener = "<script>window.opener.PopUpFutureObligationCallBack();</script>"

     RadScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "PostBackParent", refreshopener True)


    Protected Sub SaveAndAddNew _Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveAndAddNew.Click

    Condition 1.  RadScriptManager.RegisterClientScriptBlock(Pages, Pages.GetType(), "PostBackParent", refreshopener ,True)


    Condition 2.  ClientScript.RegisterStartupScript(Page.GetType(), "mykey", refreshopener, True)


    Condition 3. RadScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "PostBackParent", refreshopener True)



    End Sub



    Only condition 3 is working so I can call only the current window script unable to call the script.

    Pls look into the scenario and suggest solution....

  4. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 26 Mar 2012 Link to this post

    Take a look at this article on properly injecting the call to your JavaScript function from the server: Most likely you are using an update panel or user controls, so the your syntax is not correct. Try:
    ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType(), "PostBackParent", refreshopener, True)

    Another thing I see is that your script is configured to use a browser popup, not a RadWindow:

    where the RadWindow will load your page in an iframe, so you need the parent frame:

    I suggest you start off by launching a simple alert(1); from your code-behind, then start working your way to the functions.
Back to Top