代码之家  ›  专栏  ›  技术社区  ›  Janis Veinbergs

可以添加自定义Web部件,但不能修改页面上的任何Web部件

  •  2
  • Janis Veinbergs  · 技术社区  · 15 年前

    我的Web部件运行良好(我可以将其添加到页面并使用它)。但是,如果我想将其移动到其他区域或修改该页面上的任何其他Web部件,我会得到一个异常。

    有什么问题吗?

    可能是因为我的Web部件有一个空区域变量?然而,Web部件在页面上显示良好。详情如下。

    编辑:啊,不,我看到其他(原始的)Web部件的区域变量也为空。不管怎样,我都不知道该如何挖掘并找出问题所在。

    Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) 
    Exception Details: Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
    
    Stack Trace:     
    
    [WebPartPageUserException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
       Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveSomeChanges(SPLayoutProperties layoutProperties) +897
       Microsoft.SharePoint.WebPartPages.WebPart.SaveSomeChanges(SPLayoutProperties layoutProperties) +52
       Microsoft.SharePoint.WebPartPages.SPWebPartManager.WPSaveSomeChanges(SPLayoutProperties layoutProperties) +83
       Microsoft.SharePoint.WebPartPages.SPWebPartManager.ApplyChangeList(String changeString) +865
       Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnLoad(EventArgs e) +398
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    
    2 回复  |  直到 15 年前
        1
  •  2
  •   Kusek    15 年前

    如果下面的任何解决方案有效,请尝试

    this this this

        2
  •  1
  •   Alex Angas Colin    15 年前

    以下是一些故障排除思路:

    检查SharePoint日志

    由于这个异常没有多大帮助,您可以尝试检查SharePoint日志,并查看是否同时发生了未报告给UI的任何其他错误。这些可能会提供更多的细节。

    在任何异常上中断调试器

    如果运气不好,请尝试在工具/选项/调试中仅禁用我的代码。这将确保在Web部件之外发生错误时代码中断。然后设置debug/exceptions以检查所有clr异常,以便在SharePoint中发生的任何异常都将在错误时中断。最后将Visual Studio调试器附加到w3wp.exe并访问您的页面。请注意,调试程序将在任何异常上中断,即使是与此问题无关的异常。希望这能给你一个线索。

    注释代码

    如果这无助于缩小问题的范围,我将开始注释Web部件代码,直到错误不再发生为止。然后取消注释,直到到达导致错误的精确行。由于savechanges中存在异常,这与保持Web部件属性有关。这就是我首先要评论的地方。

    推荐文章