Category Archives: LayoutEditorPart

[RESOLVED] Editing properties in a PropertyGridEditorPart

I have several properties listed in PropertyGridEditorPart of the EditorZone.

I want to hide some of the properties at run time depending on which WebPart is being edited.

How can access the individual properties so that I can hide them?

Your help would be much appreciated.

Thanking you in anticipation.

Roger

Hi Rogerwithnell,

The PropertyGridEditorPart provides a generic user interface (UI) that enables users to edit custom properties on WebPart and server controls placed in WebPartZoneBase zones. In contrast, the other EditorPart controls, such as the AppearanceEditorPart and BehaviorEditorPart controls, edit only existing, UI-oriented properties from the WebPart class.

Because the PropertyGridEditorPart control allows you to edit only custom properties, you will need the other EditorPart controls in the Web Parts control set to edit the appearance, layout, and behavior of WebPart controls. The other controls include the BehaviorEditorPart, the LayoutEditorPart, and the AppearanceEditorPart controls. These EditorPart controls should provide most editing features required to edit WebPart controls, but if necessary, you can also create a custom editor control by inheriting from the EditorPart class.

 

The PropertyGridEditorPart control provides an editing UI for properties that are marked in the source code with the WebBrowsable attribute (from the WebBrowsableAttribute class). When a property is marked with this attribute, a PropertyGridEditorPart control creates the editing UI based on the type of the property, and uses a PropertyDescriptor object if needed to convert the value in each editing control to the type of the property. You can also add other attributes that help the PropertyGridEditorPart control to display the editing UI. The WebDisplayName attribute (from the WebDisplayNameAttribute class) allows you to specify the text for the label that appears with each control in the editing UI. The WebDescription attribute (from the WebDescriptionAttribute class) allows you to specify a string that appears as a ToolTip for each control in the editing UI.

The controls created to edit properties of various types are listed in the following table.

<div class="caption" xmlns="http://www.w3.org/1999/xhtml"></div> <div class="tableSection" xmlns="http://www.w3.org/1999/xhtml">

Property type

Control created to edit the property

String

TextBox

Int, Float, Unit

TextBox

Boolean

CheckBox

Enum

DropDownList (contains the list of enumerated values)

DateTime

TextBox

</div>

Please refer to :

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.PropertyGridEditorPart(VS.80).aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.propertygrideditorpart.aspx