Create Properties Important in Web Part for Different Control

Posted: April 7, 2015 in SharePoint2010

Introduction 

This code describe how to create web part custom properties in SharePoint 2010.

 

1.TextBox

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (“ListName”),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“ListName”),Description(“Text Property”)]
  4. Public string ListName
  5. {
  6.      get
  7.      {
  8.           Return  strList;
  9.      }
  10.      Set
  11.      {
  12.           strList=Value;
  13.      }
  14. }

2. CheckBox

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (false),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“NeedCheckBox”),Description(“Checkbox Property”)]
  4. Public bool NeedCheckBox
  5. {
  6.       get
  7.       {
  8.             Return  boolCheckBox;
  9.       }
  10.       Set
  11.       {
  12.             boolCheckBox =Value;
  13.       }
  14. }

3. RadioButton

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (true),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“NeedRadioButton”),Description(“RadioButton Property”)]
  4. Public bool NeedRadioButton
  5. {
  6.       get
  7.       {
  8.             Return  boolRadioButton;
  9.       }
  10.       Set
  11.       {
  12.             boolRadioButton;=Value;
  13.       }
  14. }
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