This code describe how to create web part custom properties in SharePoint 2010.
1.TextBox
[Browsable(true),Category ("Miscellaneous"),DefaultValue ("ListName"),
WebPartStorage(Storage.Personal),
Friendly Name("ListName"),Description("Text Property")]
Public string ListName
{
get
{
Return strList;
}
Set
{
strList=Value;
}
}
2. CheckBox
[Browsable(true),Category ("Miscellaneous"),DefaultValue (false),
WebPartStorage(Storage.Personal),
Friendly Name("NeedCheckBox"),Description("Checkbox Property")]
Public bool NeedCheckBox
{
get
{
Return boolCheckBox;
}
Set
{
boolCheckBox =Value;
}
}
3. RadioButton
[Browsable(true),Category ("Miscellaneous"),DefaultValue (true),
WebPartStorage(Storage.Personal),
Friendly Name("NeedRadioButton"),Description("RadioButton Property")]
Public bool NeedRadioButton
{
get
{
Return boolRadioButton;
}
Set
{
boolRadioButton;=Value;
}
}