SharePoint Web Part Properties
December 3rd, 2008 by Matt
When creating a WebPart inheriting from System.Web.UI.WebControls.WebParts.WebPart, use the following code to add a custom Integer property that will sit in it’s own Category when you modify the properties of the web part.
private const int _intMaxShiftsPerDay = 0; private int IntMaxShiftsPerDay = _intMaxShiftsPerDay; [Category("Custom Properties")] [DefaultValue(_intMaxShiftsPerDay)] [Personalizable(PersonalizationScope.Shared)] [WebDisplayName("Maximum Shifts Allowed Per Day")] [WebDescription("Type in the maximum allowed shifts per day for each person")] [WebBrowsable(true)] [XmlElement(ElementName = "intMaxShiftsPerDay")] public int intMaxShiftsPerDay { get { return IntMaxShiftsPerDay; } set { IntMaxShiftsPerDay = value; } }
Posted in SharePoint