我是c#的新手,我对telerik有点新意。我有这个问题:
我打开一个telerik窗口,点击一个按钮,然后点击telerik窗口中的按钮,我想在父窗口上更新网格(Telerik Grid),我成功更新了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.cs(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();
}
}
答案 0 :(得分:0)
我在telerik演示网站上找到了这个。它帮助我们解决问题