2010-06-15 81 views
1

在sharePoint 2010 Server中創建WebPart時出現以下錯誤。如何解決錯誤:「無法加載類型'Microsoft.SharePoint.WebControls.SPGridView」SharePoint 2010?

Web Part Error: Unhandled exception was thrown by the user code wrapper's Execute method in the partial trust app domain: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.TypeLoadException: Could not load type 'Microsoft.SharePoint.WebControls.SPGridView' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. at ListMenuSample.ListMenuSample.ListMenuSample.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.ExecuteHttpRequest(SPUserCodeWebPartHttpRequestContext webPartExecutionContext, SPUserCodeWebPartHttpResponse httpRequestResponse) at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.Execute(SPUserCodeExecutionContext executionContext) at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext)

+0

你能提供你的webpart cs文件或至少CreateChildControls()過程的代碼嗎? – 2010-06-16 06:16:13

回答

0

當您查看SharePoint 2010服務器時,GAC(windows \ assembly)中Microsoft.Sharepoint DLL的版本號是多少?如果你的代碼與版本14.900.00特別綁定,並且程序集中的版本不同,那麼這可能是你的問題。

另外,只是想仔細檢查一下,您是否沒有在解決方案中部署Microsoft.SharePoint DLL的副本,因爲那樣做會很糟糕。

相關問題