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?
Thanks
3 Answers, 1 is accepted
I have tried the scenario with this demo. Find the sample code pasted in the post:
Markup:
<head runat="server"> <title></title> <script type="text/javascript"> function CloseAndRebind(args) { GetRadWindow().BrowserWindow.refreshGrid(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() { GetRadWindow().close(); } </script></head><body> <form id="form1" runat="server"> <div>FirstName: <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" /> </div> </form></body>C#:
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); conn.Open(); string insertQuery = "INSERT into Employee(FirstName,LastName,Title) values('" + FirstName.Text + "','" + LatName.Text + "','" + Title.Text + "')"; SqlCommand.CommandText = insertQuery; SqlCommand.Connection = conn; SqlCommand.ExecuteNonQuery(); conn.Close(); ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true); } protected void btnCancel_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true); }}Thanks,
Princy.
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....
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:
window.opener.PopUpFutureObligationCallBack();where the RadWindow will load your page in an iframe, so you need the parent frame:
window.parent.PopUpFutureObligationCallBack();I suggest you start off by launching a simple alert(1); from your code-behind, then start working your way to the functions.