Cannot save the property settings for this Web Part. Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))


Hi all,

I was working with a webpart in MOSS and I created my custom toolpart for configuring the web part. Once, when I was trying to save the settings, I got the error – “Cannot save the property settings for this Web Part. Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))”. I was confused and when I tried to debug the webpart I was not hit by any exceptions.

After crawling through some articles I found that I was disposing the SPWeb and SPSite objects which stores the current context of the site. So I removed all the code disposing the SPWeb and SPSite objects STORING THE CURRENT CONTEXT OF THE SITE (you have to dispose the usual SPSite and SPWeb objects with Using statements or disposing them in the ‘finally’ blocks). And bingo, it worked.

You may also get the following error

"Trying to use an SPWeb object that has been closed or disposed and is no longer valid."

while trying to add a webpart.

So never dispose those objects when they belong to the current context.

Me

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