Extending SharePoint List UIs

Extending SharePoint List UIs

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The registration action performs various functions, such as validation and the creation of a SPListItem instance in the registration list. One requirement of the Training Management application is that users should not directly create a new item in the registration list. This would allow them to bypass the validation and approval processes. In addition, if users manually create their own registration list items, they must know the internal SPUser ID and the training course ID. A user-friendly application should hide such details.

Instead, the application presents users with a list of courses. Users can select a course from the list and register. The following are three possible approaches to implementing the registration action:

  • Using a custom field control
  • Using a custom DispForm.aspx
  • Using a custom action

The following sections discuss these approaches. For more information about the registration action, see the Register for a Course Use Case.

Using a Custom Field Control

One approach is to use a custom field control. Custom field controls are server controls that are used on the list view and display form. The Training Management application would use the control to display a button to initiate a registration procedure. One drawback to this approach is that custom field controls are meant to expose data in a custom field type. However, the Training Management application does not need any custom field types. Custom field controls also have a high development cost. For more information about custom field types and custom field controls, see Custom Field Types on MSDN.

Using a Custom DispForm.aspx

Another approach is to customize the DispForm.aspx page by placing a button on it that initiates the registration procedure. Writing custom .aspx pages is a common practice in SharePoint development. Initially, this approach seems to be the least expensive one. However, it requires custom code-behind. The DispForm.aspx page is a standard SharePoint page used by lists, and it already has default code-behind. Adding custom code-behind can cause unexpected behavior. Also, including the Register button on the DispForm.aspx page only allows users to register through the list view. It does not provide them with a way of seeing the list of courses and of initiating the registration process.

Using a Custom Action

A SharePoint custom action represents a link, toolbar button, menu item, or any control that can be added to a toolbar or menu that a user sees. Custom actions can be bound to a list type, a content type, a file type, or a programmatic identifier (ProgID). The custom action can invoke JavaScript, redirect the user to an URL, or perform custom code-behind procedures. The Training Management application places a custom action on the shortcut menu of the list view and on the DispForm.aspx toolbar. It redirects users to a custom .aspx page where they confirm that they would like to register for a course and they complete the registration. By presenting users with a confirmation page, the registration function can occur during postback. This is preferable to updating lists during an HTTP_GET operation, which requires that the AllowUnsafeUpdates property be set to true and may be an unsafe practice. In addition, the development cost of a custom action is minimal. For more information about custom actions, see Custom Action Definitions on MSDN.


Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Show:
© 2016 Microsoft