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

发布于 2024-07-26 03:52:42 字数 1488 浏览 4 评论 0原文

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

关于可能出什么问题的任何想法吗?

也许它与我的 Web 部件有一个空区域变量有关? 但是,Web 部件在页面上显示良好。 详细信息如下。

编辑:啊,不,我看到其他(原始)Web 部件的 Zone 变量也为 null。 无论如何,我不知道如何挖掘并找出问题。

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

I`v made my webpart that works well (I can add it to page and use it). However if i want to move it to different zone or modify ANY other webpart on that page i get an exception.

Any ideas on what could be wrong?

Maybe it has to do something with that my web part has a null Zone variable? However webpart displays well on page. Details below.

Edit: Ahh, no, I see that other (original ones) web parts have Zone variable also as null. Anyway i have no idea how to even digg and find out the problem.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢蛋碎的人ぎ生 2024-08-02 03:52:43

尝试以下任何解决方案是否有效

这个
或者

Try if any of the below solution works

this or
this or
this

潜移默化 2024-08-02 03:52:43

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

检查 SharePoint 日志

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

在出现任何异常时中断调试器

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

注释代码

如果这不能帮助缩小问题范围,我将开始注释 Web 部件代码,直到错误不再发生。 然后取消注释,直到到达导致错误的精确行。 由于 SaveChanges 是例外,因此它与保留 Web 部件属性有关。 这就是我首先开始评论的地方。

Here's some troubleshooting thoughts:

Check the SharePoint logs

As the exception doesn't help much, you could try checking the SharePoint logs and see if there are any other errors occurring at the same time that aren't reported to the UI. These might give some more detail.

Break debugger on any exceptions

If no luck, try disabling Just My Code in Tools / Options / Debugging. This will ensure your code breaks when errors occur outside of your web part. Then set Debug / Exceptions to check for all CLR exceptions so that any exceptions that occur in SharePoint will break at the error. Finally attach the Visual Studio debugger to w3wp.exe and access your page. Be aware that the debugger will break on any exception, even those that are not related to this problem. Hopefully this will give you a clue.

Comment code

If that doesn't help to narrow down the problem, I would start commenting out the web part code until the error no longer occurs. Then uncomment until you reach the precise line that causes the error. As the exception is in SaveChanges, it's something to do with persisting the web part properties. That's where I'd start commenting out first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文