[英]InvalidOperationException, PageRequestManager cannot be initialized more than once
I am using Telerik controls in Dotnetnuke custom modules, A problem has happened to all ajax controls and the result is A postback request every time instead of Ajax Request.我在 Dotnetnuke 自定义模块中使用 Telerik 控件,所有 ajax 控件都发生了问题,结果是每次都是回发请求而不是 Ajax 请求。
In Firebug i can see,在 Firebug 中,我可以看到,
Sys.InvalidOperationException: Sys.InvalidOperationException: The PageRequestManager cannot be initialized more than once.
the exception source is Telerik.Web.UI.WebResource.axd
,异常源是
Telerik.Web.UI.WebResource.axd
,
I know it's not Telerik itself but a conflict between Telerik and DOTNETNUKE AJAX, however i couldn't know where.我知道这不是 Telerik 本身,而是 Telerik 和 DOTNETNUKE AJAX 之间的冲突,但是我不知道在哪里。
Any ideas to catch this exception and handle it?任何想法来捕捉这个异常并处理它?
The problem was using telerik:RadScriptManager
问题是使用
telerik:RadScriptManager
I've used the following code to get the Excel import for RadGrid working,我使用以下代码来获取 RadGrid 的 Excel 导入工作,
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequest);
function initRequest(sender, args) {
if (args.get_postBackElement().id.indexOf("ExportTo") != -1) {
args.set_cancel(true); //stop async request
sender._form["__EVENTTARGET"].value = args.get_postBackElement().id.replace(/\_/g, "$");
sender._form["__EVENTARGUMENT"].value = "";
sender._form.submit();
return;
}
}
The solution is to delete the extra RadScriptManager, since Dotnetnuke already has one.解决方案是删除额外的 RadScriptManager,因为 Dotnetnuke 已经有了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.