Tuesday, March 18, 2008

Web Part (2)

Personalization

  • When a user makes changes to a Web Part’s properties, the Web Part Framework automatically saves these changes. For example, a user can add one or more Web Parts to a page and arrange the Web Parts with a particular layout. If the user returns to the page in the future, the Web Parts will remember the layout. This feature of the Web Part Framework is called personalization.
  • The Web Part Framework supports two types of personalization: User and Shared.
  • By default, all changes made to a Web Parts page have User scope.
  • An administrator of a Web Part application can make changes that have an effect on everyone who uses the application.
  • The default personalization provider in the Web Part Framework requires that users be authenticated. If you use the default provider, then an unauthenticated user can browse, but not customize, a Web Part application.


Creating web part:

  • The easiest way to create new Web Parts is to create User Controls.
  • Every page that contains Web Parts must include one, and only one, WebPartManager control.
  • The WebPartManager control is responsible for tracking the state of all the Web Parts on the page.
  • The WebPartManager control must appear before any other Web Parts on the page. It is a good idea to place the WebPartManager control immediately after the server-side form control in the page.


Web Part Property Attributes

  • Personalizable attribute: Any property marked with the Personalizable attribute is automatically saved and loaded by the Web Part Framework.
  • WebBrowsable attribute: Only properties marked with the WebBrowsable attribute are displayed in the property grid rendered by the PropertyGridEditorPart control.

Reference:

ASP.NET 2.0 Unleashed

blog comments powered by Disqus