简体   繁体   English

无法将WebPart添加到共享点页面

[英]can not add webpart to sharepoint page

i create a website on my local machine but i can't add webpart to web page, it don't rise any error but th webpart don't display to the page. 我在本地计算机上创建了一个网站,但无法将Webpart添加到网页中,它不会出现任何错误,但是WebPart不会显示在页面上。 anyone help me. 任何人都可以帮助我。 Thanks 谢谢

I know this is an old question, but it's ranking high in Google results, so I figured I'd answer it anyway. 我知道这是一个老问题,但是在Google搜索结果中排名很高,因此我想无论如何都要回答。

Make sure you're not running any code in the layout page's codebehind that calls and then closes SPContext.Current.Web. 确保您没有在布局页面的代码后面运行任何代码,该代码调用然后关闭SPContext.Current.Web。 I had this exact behavior and that was the culprit 我有这种确切的行为,那是元凶

To test, add a different web part to a default page layout. 要测试,请将其他Web部件添加到默认页面布局。 If it adds, then it's either your web part or your code behind. 如果添加的话,则是您的Web部件或背后的代码。 If you can't add any web parts to your custom layout, it's your code behind. 如果您无法将任何Web部件添加到自定义布局中,那么这就是您的代码。 If it's just your web part, it's your web part. 如果这只是您的Web部件,那就是您的Web部件。

Remember, SPContext.Current.Web returns a reference to the current SPWeb object. 请记住,SPContext.Current.Web返回对当前SPWeb对象的引用。 SharePoint will close the object itself when it's done, and closing it early can cause "unpredictable behavior." SharePoint将在完成时关闭对象本身,并且尽早关闭对象可能会导致“不可预测的行为”。

不久前,我们在Firefox上遇到了相同的问题,但是当我们为SharePoint 2007安装SP2时,该问题消失了。唯一让我惊讶的是,您也遇到了IE的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM