How to refresh parent page grid when close radwindow?

3 posts, 1 answers
  1. Joe
    Joe avatar
    57 posts
    Member since:
    Mar 2013

    Posted 05 Aug 2013 Link to this post

    In the parent page, it had a preview button to prompt a radwindow.

    How can I refresh the grid in parent page when user click the Close [X] button of the radwindow.

    The radwindow generate in code behind:


    Protected Sub rtbMenu_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles rtbMenu.ButtonClick
        If e.Item.Value = "Preview" Then
            Dim url = "~/TrainingAdmin/SIMPER_view.aspx?SIMPER_ID=0&UserID=" & Request.QueryString("UserID") & "&From=" & RadDatePicker_ValidFrom.SelectedDate & "&To=" & RadDatePicker_ValidTill.SelectedDate
     
            Dim windowManager As New RadWindowManager()
            Dim window1 As New RadWindow()
            ' Set the window properties  
            window1.NavigateUrl = url
            window1.ID = "RadWindow1"
            window1.Height = 750
            window1.Width = 740
            window1.Top = 140
            window1.Left = 250
     
            window1.AutoSize = False
            window1.VisibleTitlebar = True
            window1.VisibleStatusbar = False
            window1.VisibleOnPageLoad = True           
     
            ' Set this property to True for showing window from code  
            windowManager.Windows.Add(window1)
            Me.Form.Controls.Add(window1)
     
        ElseIf e.Item.Value = "Refresh" Then
            Response.Redirect("~/TrainingAdmin/SIMPER_details.aspx?userID=" & Request.QueryString("UserID"))
     
        End If
    End Sub

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

    Posted 06 Aug 2013 Link to this post

    Hi Joe,

    You can attach an OnClientClose client event for your RadWindow from C# code and in the OnClientClose event you can rebind the RadGrid as shown below.

    C#:
    window1.AutoSize = false;
    window1.VisibleTitlebar = true;
    window1.VisibleStatusbar = false;
    window1.VisibleOnPageLoad = true;
    window1.OnClientClose = "OnClientClose";

    JavaScript:
    <script type="text/javascript">
        function OnClientClose(sender, args) {
            var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
            masterTable.rebind();
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Joe
    Joe avatar
    57 posts
    Member since:
    Mar 2013

    Posted 06 Aug 2013 Link to this post

    Great. the code works.
    Thanks a lot
Back to Top