Skip to content

“ArgumentNullException: Value cannot be null.” error in Webpart Gallery

July 8, 2011

Problem:

In a Webpart Gallery when clicking on the Edit icon next to the name of the webpart the following error is shown:

Server Error in ‘/’ Application.
——————————————————————————–

Value cannot be null.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: Value cannot be null.]
Microsoft.SharePoint.SPWeb.GetServerRelativeUrlFromUrl(String fullOrRelativeUrl, Boolean includeQueryString, Boolean canonicalizeUrl) +2253
Microsoft.SharePoint.SPWeb.GetServerRelativeUrlFromUrl(String fullOrRelativeUrl) +57
Microsoft.SharePoint.WebControls.ViewWebPartXmlButton.OnLoad(EventArgs e) +313
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

——————————————————————————–
Version Information: Microsoft .NET Framework Version:2.0.50727.4961; ASP.NET Version:2.0.50727.4955

Solution:
In our case the URL was corrupted (by a custom developed module) and the value of the ID querystring attribute was replaced with some invalid value. So check that the querystring is correct and the ID contains the real ID of the listitem.

Related post: “New Item”, “Title field value.” and similar texts appear in view and edit forms instead of real values

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: