This documentation is archived and is not being maintained.

LoginViewDesigner Class

Provides design-time support in a visual designer for the LoginView Web server control.

Namespace:  System.Web.UI.Design.WebControls
Assembly:  System.Design (in System.Design.dll)

[SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)]
public ref class LoginViewDesigner : public ControlDesigner

The LoginView control renders one of its templates, determined by whether a user is logged on to the host Web site, and the roles that contain the logged-on user account.

In a visual designer, when you switch from Source to Design view, the markup source code that describes the LoginView control is parsed and a design-time version of the control is created on the design surface. When you switch back to Source view, the design-time control is persisted to the markup source code and edited into the markup for the Web page. The LoginViewDesigner class provides design-time support for the LoginView control.

The ActionLists property returns a DesignerActionListCollection object, which typically contains an object that is derived from the DesignerActionList class for each level in the inheritance tree of the designer. The TemplateGroups property returns a collection of template groups for the templates of the associated LoginView control. The UsePreviewControl property always returns true, indicating that the designer creates a temporary copy of the associated LoginView control to generate the design-time markup.

The LoginViewDesigner class methods provide the following functionality:

  • The GetDesignTimeHtml methods return the markup that is used to render the associated LoginView control at design time. The GetEmptyDesignTimeHtml method gets the markup that renders a placeholder for the associated control at design time when the current template is not defined. The GetErrorDesignTimeHtml method provides the markup that renders the associated control at design time when an error has occurred.

  • The GetEditableDesignerRegionContent method returns a serialized copy of the current template for the associated LoginView control. The SetEditableDesignerRegionContent method sets a region of the associated control from a serialized copy of a control template.

  • The Initialize method prepares the designer to view, edit, and design the associated LoginView control. The OnComponentChanged method is called when there is a change to the associated control. The PreFilterProperties method is used to remove properties from, add additional properties to, or shadow properties of the associated control.

The following code example shows how to extend the LoginViewDesigner class to change the appearance and behavior of controls that are derived from the LoginView control at design time.

The example derives the MyLoginView control from the LoginView. The MyLoginView is a copy of the LoginView control. The example also derives the MyLoginViewDesigner class from the LoginViewDesigner class and applies a DesignerAttribute attribute for the MyLoginViewDesigner on the MyLoginView control.

The MyLoginViewDesigner control overrides the following LoginViewDesigner members:

  • The PreFilterProperties method to make the NamingContainer property visible in the Properties grid at design time.

  • The GetDesignTimeHtml method to draw an orange border around the control to make its extent more visible.

  • The GetErrorDesignTimeHtml method to generate the markup for a placeholder that includes the error message, which is rendered in red, bold text.

  • The GetEmptyDesignTimeHtml method to generate the markup for a placeholder that contains the names of the role groups that are defined for the control.

  • The Initialize method to throw an ArgumentException exception, if the associated control is not a MyLoginView object.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0