Issue with refresh parent grid from radwindow

3 posts, 0 answers
  1. nav100
    nav100 avatar
    48 posts
    Member since:
    Dec 2010

    Posted 16 Sep 2013 Link to this post

    I am trying to refresh parent grid from radwindow. Here is my code. Radiwindow opens but it doesn't close and also doesn't refresh. I am not using RadAjaxManager because RadAjaxManager is on the Master page. Please let me know what am I doing wrong?

    Parent Page Code:
    <script type="text/javascript">
        function refreshGrid() {
            var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();

    <telerik:RadWindowManager runat="server" ID="RadWindowManager1" OnClientClose="refreshGrid" />
      <telerik:RadGrid ID="RadGrid1"
                    GridLines="None" Skin="Default" OnNeedDataSource="RadGrid1_NeedDataSource"
                     OnItemCommand="RadGrid1_ItemCommand"   >
     <MasterTableView DataKeyNames="id" PageSize="50" EditMode="EditForms">
    <telerik:GridButtonColumn Text="View/Edit" UniqueName="EditColumn" CommandName="EditLink"></telerik:GridButtonColumn>

    .aspx.cs code
            protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
                long ID = Convert.ToInt64((e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["item_id"]));
                if (e.CommandName == "EditLink")
                    RadWindow win = new RadWindow();
                    win.ID = "window1";
                    win.VisibleOnPageLoad = true;
                    win.NavigateUrl = "Page1.aspx?ID=" + ID.ToString();

    Radwindow page:(Child Window)
    <script type="text/javascript">
        function CloseAndRebind() {
            var oWin = GetRadWindow();
            var parentWindow = oWin.BrowserWindow;
            $(oWin).ready(function () {

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

            return oWindow;

    .aspx page
    <asp:Button ID="Save" Text="Save" runat="server" OnClick="save_Click" />

    Code behind
            protected void save_Click(object sender, EventArgs e)

                    //Close Pop up
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "mykey", "CloseAndRebind();", true);

  2. nav100
    nav100 avatar
    48 posts
    Member since:
    Dec 2010

    Posted 17 Sep 2013 Link to this post

    telerik experts, Could you please help? I was able to open the RadWindow and submit the page. Now I would like to refresh only the parent grid after the window closes.  I see on your site the demo with AjaxManager on the page. But I am not sure how to use AjaxManager in my case because it is already exists in master page.
  3. DevCraft R3 2016 release webinar banner
  4. Konstantin Dikov
    Konstantin Dikov avatar
    1750 posts

    Posted 19 Sep 2013 Link to this post

    Hi Nara,

    I am glad to see that you were able to find solution for some of the issues. 

    Now for you current question, regarding the Master/Content page scenario: in a complex scenario like WebUserControls or Master/ContentPages you should use RadAjaxManager in the Master page and RadAjaxManagerProxy in the Content page. Please refer to the following help article: "RadAjaxManagerProxy".

    Furthermore for your scenario I may suggest that you fire an AJAX request within the "refreshGrid" function with RadGrid as initiator (the RadGrid must be set as AJAX initiator and as "UpdatedControl" in the RadAjaxManagerProxy as well). More information could be found at this help article.

    Another important thing that should be pointed out is that you need to move the following line from the "ItemCommand" server-side event to the "Page_Load" event in order to overcome ViewState errors that will occur:
    win = new RadWindow();
    win.ID = "window1";

    Hope that helps.


    Konstantin Dikov
    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 the blog feed now.
Back to Top