简体   繁体   中英

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. 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.

Make sure you're not running any code in the layout page's codebehind that calls and then closes 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. If it adds, then it's either your web part or your code behind. If you can't add any web parts to your custom layout, it's your code behind. If it's just your web part, it's your web part.

Remember, SPContext.Current.Web returns a reference to the current SPWeb object. SharePoint will close the object itself when it's done, and closing it early can cause "unpredictable behavior."

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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