Monday, September 14, 2009

FieldContentPanel

The FieldContentPanel is a simple derivative of the standard System.Web.UI.WebControls.Panel. The control is extended with the functionality to suppress itself and it's contents depending on the presence of a value for the given field from the current page/listitem.

This control is based on this posting of Andrew Connell. The sourcecode and the ready-to-use WSP is available for download from the MRCL Codeplex Subversion repository.

This is an example of typical usage of the control:


The FieldName-attribute/property defines which field of the current listitem/page which will be checked for an empty value.

The AlwaysShowInEditMode-attribute/property defines if the panel needs to be displayed in edit-mode even if the fieldvalue would be empty. This setting is important when the FieldContentPanel checks the same field as one of it´s children FieldControl(s). Without this setting one would be unable to change the value of a Field after it has been set to empty.

The solution is built using Visual Studio 2008 and WSPBuilder. This version of the control is usable in WSS3 and Moss2007.

The control can be easily be extended to support custom field-types which have specific empty values.

No comments:

Post a Comment