Telerik RadWindow problem
本文关键字:problem RadWindow Telerik | 更新日期: 2023-09-27 17:58:15
我对c#有点陌生,对telerik也有点陌生。我有这个问题:
我点击一个按钮打开一个telerik窗口,然后点击telerik中的按钮。我想更新父窗口上的网格(telerik网格),我成功更新了telerik网格,而没有进行回发。但当我点击telerik窗口中的按钮时,它会完成工作并更新网格,但它会再次打开一个新的telrik窗口。
我不知道为什么会这样。下面是一段代码。任何建议都将不胜感激。
RejectLeaveRequest.aspx(telerik窗口)上的Java脚本函数:
function CloseAndRebind(args) {
GetRadWindow().close();
GetRadWindow().BrowserWindow.refreshGrid(args);
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) {
oWindow = window.radWindow; }
else if (window.frameElement.radWindow) {
oWindow = window.frameElement.radWindow;
}
return oWindow;
}
RejectLeaveRequest.aspx的代码隐藏(telerik窗口):
protected void btnReject_Click(object sender, EventArgs e)
{
//Code for delete records
//
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind(this);", true); // Call client method in radwindow page
}
Approval.aspx上的Java脚本函数:
function refreshGrid() {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
}
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="gvLeaveApproval" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="gvLeaveApproval">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="gvLeaveApproval" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<asp:UpdatePanel ID="updRadWindow" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
</telerik:RadWindowManager>
</ContentTemplate>
</asp:UpdatePanel>
Approval.aspx的代码隐藏:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
if (e.Argument == "Rebind")
{
SelectEmployeeLeaveRequested();
}
}
我在telerik演示网站上发现了这个。它帮助我们解决了问题
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window