Cannot save all of the property settings for this Web Part – Sharepoint

custom-propertiessharepointsharepoint-2010

"Cannot save all of the property settings for this Web Part. The
default namespace "http://schemas.microsoft.com/WebPart/v2" is a
reserved namespace for base Web Part properties. Custom Web Part
properties require a unique namespace (specified through an
XmlElementAttribute on the property, or an XmlRootAttribute on the
class)."

No where do I get help regarding this error.

This is when adding custom properties to my webpart, why cant I save the properties when I edit my webpart and click on save/apply? (then I get that error)

Code–

     [DefaultProperty("Text"), ToolboxData("<{0}:CustomPropertyWebPart runat=server></{0}:CustomPropertyWebPart>"),
            XmlRoot(Namespace = "ExecuteStoreProc")]
            public class CustomPropertyWebPart : Microsoft.SharePoint.WebPartPages.WebPart
            {
                const string c_MyStringDefault = "Sample String";
            }

            // Create a custom category in the property sheet.
            [Category("Custom Properties")]
            // Assign the default value.
            [DefaultValue(c_MyStringDefault)]
            // Property is available in both Personalization
            // and Customization mode.
            [WebPartStorage(Storage.Personal)]
            // The caption that appears in the property sheet.
            [FriendlyNameAttribute("Custom String")]
            // The tool tip that appears when pausing the mouse pointer over
        // the friendly name in the property pane.
        [Description("Type a string value.")]
        // Display the property in the property pane.
        [Browsable(true)]
        [XmlElement(ElementName = "MyString")]

        // The accessor for this property.
        public string MyString
        {
            get
            {
                return _myString;
            }
            set
            {
                _myString = value;
            }
        }

Best Answer

Can you try going to Site Settings > Galleries > Web Part > New In that window, put a checkbox next to the webpart you are trying to add, then click Populate

If its populate correctly then it is working otherwise there is some error in the webpart.

Return to your webpage where you want to add the webpart, try to add the webpart by selecting it in the gallery.

If this works (you were able to add it to your page), you can open the webpart added in your webpart gallery (Site Settings > Galleries > Web Part) and compare it to your own .dwp file to see what you did wrong.

Hope this helps

Related Topic