Skip to Main Content
Essential SharePoint 2007, 2nd Edition
book

Essential SharePoint 2007, 2nd Edition

by Jeff Webb
September 2007
Beginner content levelBeginner
448 pages
10h 2m
English
O'Reilly Media, Inc.
Content preview from Essential SharePoint 2007, 2nd Edition

Customizing the Property Task Pane

SharePoint generates the controls displayed in the web part properties pane based on the data type of the property and whether or not it is marked as WebBrowsable in the property attributes. Table 11-6 lists the controls generated for various data types.

Table 11-6. Default property pane control types

Type

Generated control

String

Text box

Numeric

Text box

Date

Text box

Boolean

Checkbox

Array

Drop-down box

Enumeration

Drop-down list box

You can override that behavior by creating custom editor parts that render one or more controls in the properties pane.

To display a custom editor part in the web part properties task pane:

  1. Create an EditorPart class that renders the editor to display.

  2. Override the web part's CreateEditorParts method to add the new EditorPart to the EditorPartCollection.

For example, the following class creates an editor part that displays a calendar in the properties pane:

 // Create a custom EditorPart to edit the WebPart. class CalendarEditorPart : EditorPart { Calendar _cal; DateTime _date; // Get settings from web part. public override void SyncChanges( ) { Properties4 part = (Properties4)this.WebPartToEdit; _date = part.CalDate; } // Apply new settings to web part. public override bool ApplyChanges( ) { Properties4 part = (Properties4)this.WebPartToEdit; // Update the web part with the selected date. part.CalDate = this._cal.SelectedDate; return true; } // Render the control. protected override void CreateChildControls( ) { // Set the title to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Office SharePoint® Server 2007 Best Practices

Microsoft® Office SharePoint® Server 2007 Best Practices

Ben Curry, Bill English
SharePoint 2007: The Definitive Guide

SharePoint 2007: The Definitive Guide

James Pyles, Christopher M. Buechler, Bob Fox, Murray Gordon, Michael Lotter, Jason Medero, Nilesh Mehta, Joris Poelmans, Christopher Pragash, Piotr Prussak, Christopher J. Regan

Publisher Resources

ISBN: 9780596514075Errata Page