vb.net 关闭radwindow时如何刷新父页面网格?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18054907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:32:41  来源:igfitidea点击:

How to refresh parent page grid when close radwindow?

asp.netvb.netgridtelerik

提问by Joe Yan

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

在父页面中,它有一个预览按钮来提示一个 radwindow。

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

当用户单击 radwindow 的关闭 [X] 按钮时,如何刷新父页面中的网格。

The radwindow generate in code behind:

radwindow 在后面的代码中生成:

   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

采纳答案by rdmptn

Take a look here: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window. This demo from Telerik shows how you can use the OnClientCloseevent of the RadWindow control to initiate a partial postback that will update the grid. Note that a lot of the code is in the main page where the grid is, not in the content page loaded in RadWindow.

看看这里:http: //demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window。Telerik 的这个演示展示了如何使用RadWindow 控件的OnClientClose事件来启动将更新网格的部分回发。请注意,很多代码位于网格所在的主页面中,而不是在 RadWindow 中加载的内容页面中。

This approach for opening a RadWindow from the code-behind is better in case you cannot use the client-side logic from the demo: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx.

如果您无法使用演示中的客户端逻辑,这种从代码隐藏打开 RadWindow 的方法会更好:http: //www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow -from-the-server.aspx