Export (0) Print
Expand All

GridViewDesigner Class

Provides design-time support in a visual designer for the GridView control.

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

public ref class GridViewDesigner : public DataBoundControlDesigner
public class GridViewDesigner extends DataBoundControlDesigner
public class GridViewDesigner extends DataBoundControlDesigner
Not applicable.

In a visual designer, when you switch from Source to Design view, the markup source code that describes the GridView 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 properties of the GridViewDesigner class provide the following functionality:

  • 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 AutoFormats property returns a collection of formatting schemes for display in the Auto Format dialog box.

  • The TemplateGroups property returns a collection of template groups for the fields of the associated GridView control and the top-level GridView templates.

  • The UsePreviewControl property always returns true, indicating that the designer creates a temporary copy of the associated GridView to generate the design-time markup.

The methods of the GridViewDesigner class provide the following functionality:

  • The DataBind method binds the associated GridView control to a design-time data source.

  • The GetDesignTimeHtml method returns the markup that is used to render the associated GridView at design time.

  • The Initialize method prepares the designer to view, edit, and design the associated GridView.

  • The OnClick method is called when a region of the design-time view of the associated GridView is clicked.

  • The OnSchemaRefreshed method is called when the schema of the data source of the associated GridView changes.

  • The PreFilterProperties method is used to remove or add properties or to shadow properties of the associated GridView.

Design-time editable regions are not supported in the GridView control, so the GetEditableDesignerRegionContent and SetEditableDesignerRegionContent methods have no functionality.

The following code example shows how to extend the GridViewDesigner class to change the appearance of controls that are derived from the GridView control at design time.

The example derives the MyGridView control from the GridView. The MyGridView is simply a copy of the GridView. The example also derives the MyGridViewDesigner class from the GridViewDesigner class and places a DesignerAttribute object for the MyGridViewDesigner on the MyGridView control.

The MyGridViewDesigner overrides the PreFilterProperties method to make the Page property visible in the Properties grid at design time. It overrides the GetDesignTimeHtml method to include the Caption property, if it is specified, as a new first row in the MyGridView control at design time. If the BorderStyle property of the MyGridView control has the NotSet or None value, the GetDesignTimeHtml draws a blue dashed border around the control to make its extent more visible.

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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft