【问题标题】:UpdatePanel in SharePoint throws an errorSharePoint 中的 UpdatePanel 引发错误
【发布时间】:2010-02-25 20:34:22
【问题描述】:

当我单击 Web 部件库中的自定义 Web 部件时,我得到以下信息:The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it. 如果我使用 Web 部件,即执行搜索,我收到一个弹出错误:Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The Status code returned from the server was: 500

此 Web 部件从文本框中获取搜索字符串,将其传递给 BL/DAL 并从 DB 返回数据。我已经为部分回发集成了一个 UpdatePanel - 使用 this blog 作为指南,但它不起作用。

按照博客的建议,我已使用 MSSP Designer 将 scriptManager 添加到 default.master 页面,但奇怪的是,脚本管理器会导致错误(红色下划线)In Internet Explorer 6.0 the tag <asp:ScriptManager> is not permitted.

【问题讨论】:

    标签: sharepoint asp.net-ajax


    【解决方案1】:

    我不完全确定这是怎么回事,但这里有一个替代方案。不要使用 MS Ajax - 永远。 jQuery 更简单、更快、更好、更强、更性感!

    这就是我通常做这些事情的方式:

    1. 将 jQuery 添加到您的母版页头部
    2. 创建实现 Web 部件 ui 的用户控件。这应该使用 Page.ScriptManager.RegistryScriptInclude 或 .RegistryScriptBlock 为控件插入脚本。例如,使用 jQuery.Ajax 进行回调的方法。
    3. 为用户控件创建 Web 部件包装器
    4. 在 _layouts 中创建一个 aspx,作为回调的“服务”。页面加载可以使用ajax调用传来的参数返回一些json或者文本

    您可以创建一个 Web 服务而不是 #4,但是这对于 SharePoint 来说要困难得多 - 一个 apx 就可以很好地工作。

    HTH

    干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-31
      • 2011-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-12
      • 1970-01-01
      • 2015-01-17
      相关资源
      最近更新 更多