“无法保存此 Web 部件的所有属性设置。默认命名空间“ http://schemas.microsoft.com/WebPart/v2 ”是为基本 Web 部件属性保留的命名空间。自定义 Web 部件属性需要唯一的命名空间(通过属性上的 XmlElementAttribute 或类上的 XmlRootAttribute 指定)。”
没有关于此错误的帮助。
这是向我的 web 部件添加自定义属性时,为什么我在编辑 web 部件并单击保存/应用时无法保存属性?(然后我得到那个错误)
代码 -
[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;
}
}