Thursday, June 12, 2008

Creating WebBrowsable Properties in WebParts

use WebBrowable along with Personalizable attribute on the Public Property to get property visible in the Editors Section.

for example if you want to display the Public Property Show Zipcode... use the below code.

private string _sZipCode;
[WebBrowsable]
[Personalizable]
Public string SetZipCode
{
get {return _sZipCode; }
set {_sZipCode = value; }
}

this would appear in the Misc Section when Modify Webpart is selected.

No comments: