How to refresh parent page grid when close radwindow?

5 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  
        ElseIf e.Item.Value = "Refresh" Then
            Response.Redirect("~/TrainingAdmin/SIMPER_details.aspx?userID=" & Request.QueryString("UserID"))
        End If
    End Sub

  2. Answer
    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.

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

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

  3. Joe
    Joe avatar
    57 posts
    Member since:
    Mar 2013

    Posted 06 Aug 2013 Link to this post

    Great. the code works.
    Thanks a lot
  4. Ronald
    Ronald avatar
    1 posts
    Member since:
    Jul 2017

    Posted 31 May 2018 in reply to Princy Link to this post

    What if a RadGrid is not using the NeedDataSource event, but instead the data source is being set in a RadTabStrip TabClick event where I bind the datasource to a List<> of custom objects.

    Does rebinding the Master Table work in that scenario conform to your example here?


  5. Marin Bratanov
    Marin Bratanov avatar
    4533 posts

    Posted 01 Jun 2018 Link to this post

    Hello Ronald,

    With such simple data binding it is likely that a lot of the complex features (like sorting, grouping, filtering and so on) will not function. Thus, I recommend that you move towards the NeedDataSource data binding or using a declarative data source (you can set the grid's Visible property to false to prevent it from data binding if you don't want it to):

    If you want to keep using such simple data binding, I'd suggest you invoke a postback (e.g., click a hidden button programmatically) and provide the new data source to the grid. The .rebind() method may not work as expected in such a case because the grid cannot know what it;s data source is - it is not a declarative data source it can ask to fetch data, nor is its NeedDataSource event hooked, it expects the developer to provide data.

    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top