Export (0) Print
Expand All

DataGridDesigner Class

Extends design-time behavior for the DataGrid Web server control.

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

[SupportsPreviewControlAttribute(true)]
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public class DataGridDesigner : BaseDataListDesigner

The DataGridDesigner type exposes the following members.

  NameDescription
Public methodDataGridDesignerInitializes a new instance of the DataGridDesigner class.
Top

  NameDescription
Public propertyActionListsGets the designer action list collection for this designer. (Inherited from BaseDataListDesigner.)
Public propertyActiveTemplateEditingFrame Obsolete. Gets the active template editing frame. (Inherited from TemplatedControlDesigner.)
Public propertyAllowResizeGets a value indicating whether the control can be resized in the design-time environment. (Inherited from ControlDesigner.)
Public propertyAssociatedComponentsGets the collection of components associated with the component managed by the designer. (Inherited from ComponentDesigner.)
Public propertyAutoFormatsGets the DesignerAutoFormatCollection object associated with this designer. (Overrides ControlDesigner.AutoFormats.)
Public propertyBehavior Obsolete. Gets or sets the DHTML behavior that is associated with the designer. (Inherited from HtmlControlDesigner.)
Public propertyCanEnterTemplateModeGets a value indicating whether or not this designer will allow the viewing or editing of templates. (Inherited from TemplatedControlDesigner.)
Public propertyComponentGets the component this designer is designing. (Inherited from ComponentDesigner.)
Public propertyDataBindingsGets the data bindings collection for the current control. (Inherited from HtmlControlDesigner.)
Protected propertyDataBindingsEnabledInfrastructure. Gets a value indicating whether the designer allows data binding. (Inherited from TemplatedControlDesigner.)
Public propertyDataKeyFieldGets or sets the value of the data key field of the associated control. (Inherited from BaseDataListDesigner.)
Public propertyDataMemberGets or sets the value of the data member field of the associated control. (Inherited from BaseDataListDesigner.)
Public propertyDataSourceGets or sets the value of the data source property of the associated control. (Inherited from BaseDataListDesigner.)
Public propertyDataSourceDesignerGets the designer of the data source, when one is selected for data binding. (Inherited from BaseDataListDesigner.)
Public propertyDataSourceIDGets or sets the designer's version of the data source ID property and is used to shadow the corresponding property of the associated control. (Inherited from BaseDataListDesigner.)
Protected propertyDesignerStateGets an object that is used to persist data for the associated control at design time. (Inherited from ControlDesigner.)
Public propertyDesignerViewGets the default view of the data source that is bound to the associated control. (Inherited from BaseDataListDesigner.)
Protected propertyDesignTimeElement Obsolete. Gets the design-time object representing the control that is associated with the HtmlControlDesigner object on the design surface. (Inherited from HtmlControlDesigner.)
Protected propertyDesignTimeElementView Obsolete. Gets the view-control object for the control designer. (Inherited from ControlDesigner.)
Public propertyDesignTimeHtmlRequiresLoadComplete Obsolete. Gets a value indicating whether the design host must finish loading before the GetDesignTimeHtml method can be called. (Inherited from ControlDesigner.)
Public propertyExpressionsGets the expression bindings for the current control at design time. (Inherited from HtmlControlDesigner.)
Protected propertyHidePropertiesInTemplateModeInfrastructure. Gets a value indicating whether the properties of the associated control are hidden when the control is in template mode. (Inherited from ControlDesigner.)
Public propertyIDGets or sets the ID string for the control. (Inherited from ControlDesigner.)
Protected propertyInheritanceAttributeGets an attribute that indicates the type of inheritance of the associated component. (Inherited from ComponentDesigner.)
Protected propertyInheritedGets a value indicating whether this component is inherited. (Inherited from ComponentDesigner.)
Public propertyInTemplateMode Obsolete. Gets a value indicating whether the designer document is in template mode. (Inherited from TemplatedControlDesigner.)
Public propertyIsDirty Obsolete. Gets or sets a value indicating whether the Web server control has been marked as changed. (Inherited from ControlDesigner.)
Protected propertyParentComponentGets the parent component for this designer. (Inherited from ComponentDesigner.)
Public propertyReadOnly Obsolete. Gets or sets a value indicating whether the properties of the control are read-only at design time. (Inherited from ControlDesigner.)
Protected propertyRootDesignerGets the control designer for the Web Forms page that contains the associated control. (Inherited from ControlDesigner.)
Protected propertyShadowPropertiesGets a collection of property values that override user settings. (Inherited from ComponentDesigner.)
Public propertyShouldCodeSerialize Obsolete. Gets or sets a value indicating whether to create a field declaration for the control in the code-behind file for the current design document during serialization. (Inherited from HtmlControlDesigner.)
Protected propertyTagGets an object representing the HTML markup element for the associated control. (Inherited from ControlDesigner.)
Public propertyTemplateGroupsGets a collection of template groups, each containing a template definition. (Inherited from TemplatedControlDesigner.)
Protected propertyUsePreviewControlGets a value indicating whether the control designer uses a temporary preview control to generate the design-time HTML markup. (Inherited from ControlDesigner.)
Public propertyVerbsGets the design-time verbs supported by the component that is associated with the designer. (Inherited from ComponentDesigner.)
Public propertyViewControlGets or sets a Web server control that can be used for previewing the design-time HTML markup. (Inherited from ControlDesigner.)
Public propertyViewControlCreatedGets or sets a value indicating whether a View control has been created for display on the design surface. (Inherited from ControlDesigner.)
Protected propertyVisibleGets a value that indicates whether the control is visible at design time. (Inherited from ControlDesigner.)
Top

  NameDescription
Protected methodCreateErrorDesignTimeHtml(String)Creates HTML markup to display a specified error message at design time. (Inherited from ControlDesigner.)
Protected methodCreateErrorDesignTimeHtml(String, Exception)Creates the HTML markup to display a specified exception error message at design time. (Inherited from ControlDesigner.)
Protected methodCreatePlaceHolderDesignTimeHtml()Provides a simple rectangular placeholder representation that displays the type and ID of the control. (Inherited from ControlDesigner.)
Protected methodCreatePlaceHolderDesignTimeHtml(String)Provides a simple rectangular placeholder representation that displays the type and ID of the control, and also additional specified instructions or information. (Inherited from ControlDesigner.)
Protected methodCreateTemplateEditingFrame Obsolete. Creates a template editing frame using the specified verb. (Overrides TemplatedControlDesigner.CreateTemplateEditingFrame(TemplateEditingVerb).)
Protected methodCreateViewControlReturns a copy of the associated control for viewing or rendering on the design surface. (Inherited from ControlDesigner.)
Public methodDispose()Releases all resources used by the ComponentDesigner. (Inherited from ComponentDesigner.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the DataGridDesigner object and optionally releases the managed resources. (Overrides BaseDataListDesigner.Dispose(Boolean).)
Public methodDoDefaultActionCreates a method signature in the source code file for the default event on the component and navigates the user's cursor to that location. (Inherited from ComponentDesigner.)
Public methodEnterTemplateMode Obsolete. Opens a particular template frame object for editing in the designer. (Inherited from TemplatedControlDesigner.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodExitTemplateMode Obsolete. Closes the currently active template editing frame after saving any relevant changes. (Inherited from TemplatedControlDesigner.)
Protected methodFinalizeAttempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection. (Inherited from ComponentDesigner.)
Public methodGetBoundsRetrieves the coordinates of the rectangle representing the boundaries for the control as displayed on the design surface. (Inherited from ControlDesigner.)
Protected methodGetCachedTemplateEditingVerbs Obsolete. Gets the cached template editing verbs available to the designer. (Overrides TemplatedControlDesigner.GetCachedTemplateEditingVerbs().)
Protected methodGetDesignTimeDataSource(Int32, Boolean)Generates an object that can be used as a data source at design time. (Inherited from BaseDataListDesigner.)
Protected methodGetDesignTimeDataSource(IEnumerable, Int32, Boolean)Generates an object that can be used as a data source at design time. (Inherited from BaseDataListDesigner.)
Public methodGetDesignTimeHtml()Gets the HTML markup used to represent the DataGrid control at design time. (Overrides ControlDesigner.GetDesignTimeHtml().)
Public methodGetDesignTimeHtml(DesignerRegionCollection)Retrieves the HTML markup to display the control and populates the collection with the current control designer regions. (Inherited from ControlDesigner.)
Public methodGetEditableDesignerRegionContentReturns the content for an editable region of the design-time view of the associated control. (Inherited from ControlDesigner.)
Protected methodGetEmptyDesignTimeHtmlGets the HTML markup used to represent an empty template-based control at design time. (Overrides ControlDesigner.GetEmptyDesignTimeHtml().)
Protected methodGetErrorDesignTimeHtmlGets the HTML markup displayed at design time for the specified exception when an error has been encountered while rendering the control. (Overrides ControlDesigner.GetErrorDesignTimeHtml(Exception).)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetPersistenceContentRetrieves the persistable inner HTML markup of the control at design time. (Inherited from ControlDesigner.)
Public methodGetPersistInnerHtml Obsolete. Retrieves the persistable inner HTML markup of the control. (Inherited from ControlDesigner.)
Public methodGetResolvedSelectedDataSourceGets the data source component from the associated control container, resolved to a specific data member. (Inherited from BaseDataListDesigner.)
Public methodGetSelectedDataSourceGets the data source component from the associated control container. (Inherited from BaseDataListDesigner.)
Protected methodGetServiceAttempts to retrieve the specified type of service from the design mode site of the designer's component. (Inherited from ComponentDesigner.)
Public methodGetTemplateContainerDataItemProperty Obsolete. Gets the data item property of the template container. (Overrides TemplatedControlDesigner.GetTemplateContainerDataItemProperty(String).)
Public methodGetTemplateContainerDataSource Obsolete. Gets the data source of the template's container. (Inherited from BaseDataListDesigner.)
Public methodGetTemplateContent Obsolete. Gets the content of the template. (Overrides TemplatedControlDesigner.GetTemplateContent(ITemplateEditingFrame, String, Boolean).)
Public methodGetTemplateEditingVerbs Obsolete. Gets the template editing verbs available to the designer. (Inherited from TemplatedControlDesigner.)
Protected methodGetTemplateFromTextCreates a template from the specified text. (Inherited from TemplatedControlDesigner.)
Public methodGetTemplatePropertyParentType Obsolete. Gets the Type object corresponding to the parent of the specified template. (Overrides TemplatedControlDesigner.GetTemplatePropertyParentType(String).)
Protected methodGetTextFromTemplateGets a string of text that represents the specified template. (Inherited from TemplatedControlDesigner.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetViewRendering()Retrieves an object that contains the design-time markup for the content and regions of the associated control. (Inherited from ControlDesigner.)
Public methodInitializeInitializes the designer with the specified DataGrid control. (Overrides BaseDataListDesigner.Initialize(IComponent).)
Public methodInitializeExistingComponentReinitializes an existing component. (Inherited from ComponentDesigner.)
Public methodInitializeNewComponentInitializes a newly created component. (Inherited from ComponentDesigner.)
Public methodInitializeNonDefault Obsolete. Initializes the settings for an imported component that is already initialized to settings other than the defaults. (Inherited from ComponentDesigner.)
Public methodInvalidate()Invalidates the whole area of the control that is displayed on the design surface and signals the control designer to redraw the control. (Inherited from ControlDesigner.)
Public methodInvalidate(Rectangle)Invalidates the specified area of the control that is displayed on the design surface and signals the control designer to redraw the control. (Inherited from ControlDesigner.)
Protected methodInvokeGetInheritanceAttributeGets the InheritanceAttribute of the specified ComponentDesigner. (Inherited from ComponentDesigner.)
Protected methodInvokePropertyBuilderInvokes a component editor for the associated control. (Inherited from BaseDataListDesigner.)
Public methodIsPropertyBound Obsolete. Retrieves a value indicating whether the specified property on the associated control is data-bound. (Inherited from ControlDesigner.)
Public methodLocalizeUses the provided resource writer to persist the localizable properties of the associated control to a resource in the design host. (Inherited from ControlDesigner.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnAutoFormat Obsolete. Handles the AutoFormat event. (Inherited from BaseDataListDesigner.)
Public methodOnAutoFormatAppliedCalled when an automatic formatting scheme has been applied to the associated control. (Inherited from BaseDataListDesigner.)
Protected methodOnBehaviorAttached Obsolete. Provides an opportunity to perform additional processing when a behavior is attached to the designer. (Inherited from TemplatedControlDesigner.)
Protected methodOnBehaviorDetaching Obsolete. Called when a behavior disassociates from the element. (Inherited from HtmlControlDesigner.)
Protected methodOnBindingsCollectionChanged Obsolete. Called when the data-binding collection changes. (Inherited from ControlDesigner.)
Protected methodOnClickCalled by the design host when the user clicks the associated control at design time. (Inherited from ControlDesigner.)
Public methodOnColumnsChangedCalled when the columns of the template change.
Public methodOnComponentChangedCalled when there is a change to the associated control. (Inherited from BaseDataListDesigner.)
Public methodOnComponentChangingRepresents the method that will handle the ComponentChanging event for the associated control. (Inherited from ControlDesigner.)
Protected methodOnControlResize Obsolete. Called when the associated Web server control has been resized in the design host at design time. (Inherited from ControlDesigner.)
Protected methodOnDataSourceChangedCalled when the data source for the associated control has changed. (Inherited from BaseDataListDesigner.)
Protected methodOnPaintCalled when the control designer draws the associated control on the design surface, if the CustomPaint value is true. (Inherited from ControlDesigner.)
Protected methodOnPropertyBuilderRepresents the method that handles the property-builder event. (Inherited from BaseDataListDesigner.)
Protected methodOnSchemaRefreshedCalled when the schema of the data source for the associated control changes. (Inherited from BaseDataListDesigner.)
Public methodOnSetComponentDefaults Obsolete. Sets the default properties for the component. (Inherited from ComponentDesigner.)
Public methodOnSetParentProvides an opportunity to perform additional processing when the parent of this designer is changed. (Inherited from TemplatedControlDesigner.)
Protected methodOnStylesChangedCan be overridden to implement functionality that should occur when a style of the associated control has changed. (Inherited from BaseDataListDesigner.)
Protected methodOnTemplateEditingVerbsChangedCalled when the template editing verbs change. (Overrides BaseDataListDesigner.OnTemplateEditingVerbsChanged().)
Protected methodOnTemplateModeChangedProvides an opportunity to perform additional processing when the template mode is changed. (Inherited from TemplatedControlDesigner.)
Protected methodPostFilterAttributesAllows a designer to change or remove items from the set of attributes that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected methodPostFilterEventsAllows a designer to change or remove items from the set of events that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected methodPostFilterPropertiesAllows a designer to change or remove items from the set of properties that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected methodPreFilterAttributesAllows a designer to add to the set of attributes that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected methodPreFilterEventsSets the list of events that are exposed at design-time for the TypeDescriptor object for the component. (Inherited from HtmlControlDesigner.)
Protected methodPreFilterPropertiesUsed by the designer to remove properties from or add additional properties to the display in the Properties grid or to shadow properties of the associated control. (Inherited from BaseDataListDesigner.)
Protected methodRaiseComponentChangedNotifies the IComponentChangeService that this component has been changed. (Inherited from ComponentDesigner.)
Protected methodRaiseComponentChangingNotifies the IComponentChangeService that this component is about to be changed. (Inherited from ComponentDesigner.)
Public methodRaiseResizeEvent Obsolete. Raises the OnControlResize event. (Inherited from ControlDesigner.)
Public methodRegisterCloneRegisters internal data in a cloned control. (Inherited from ControlDesigner.)
Protected methodSaveActiveTemplateEditingFrameSaves the active template editing frame. (Inherited from TemplatedControlDesigner.)
Public methodSetEditableDesignerRegionContentSpecifies the content for an editable region of the control at design time. (Inherited from ControlDesigner.)
Protected methodSetRegionContentSpecifies the content for an editable region in the design-time view of the control. (Inherited from ControlDesigner.)
Public methodSetTemplateContent Obsolete. Sets the content for the specified template and frame. (Overrides TemplatedControlDesigner.SetTemplateContent(ITemplateEditingFrame, String, String).)
Protected methodSetViewFlagsAssigns the specified bitwise ViewFlags enumeration to the specified flag value. (Inherited from ControlDesigner.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodUpdateDesignTimeHtmlUpdates the design-time HTML. (Inherited from TemplatedControlDesigner.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIDataBindingSchemaProvider.CanRefreshSchemaFor a description of this member, see CanRefreshSchema. (Inherited from BaseDataListDesigner.)
Explicit interface implemetationPrivate methodIDataBindingSchemaProvider.RefreshSchemaFor a description of this member, see RefreshSchema. (Inherited from BaseDataListDesigner.)
Explicit interface implemetationPrivate propertyIDataBindingSchemaProvider.SchemaFor a description of this member, see Schema. (Inherited from BaseDataListDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PostFilterAttributesFor a description of this member, see the IDesignerFilter.PostFilterAttributes method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PostFilterEventsFor a description of this member, see the IDesignerFilter.PostFilterEvents method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PostFilterPropertiesFor a description of this member, see the IDesignerFilter.PostFilterProperties method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PreFilterAttributesFor a description of this member, see the IDesignerFilter.PreFilterAttributes method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PreFilterEventsFor a description of this member, see the IDesignerFilter.PreFilterEvents method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate methodIDesignerFilter.PreFilterPropertiesFor a description of this member, see the IDesignerFilter.PreFilterProperties method. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate propertyITreeDesigner.ChildrenFor a description of this member, see the ITreeDesigner.Children property. (Inherited from ComponentDesigner.)
Explicit interface implemetationPrivate propertyITreeDesigner.ParentFor a description of this member, see the ITreeDesigner.Parent property. (Inherited from ComponentDesigner.)
Top

The following code example demonstrates how to extend the DataGridDesigner class. The code overrides the GetDesignTimeHtml method to customize the CellPadding, BorderWidth, and BorderColor properties when the DataGrid control is rendered on a design surface.

Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Imports System.Drawing
Imports System.Web.UI.Design.WebControls
Imports System.Web.UI.WebControls

Namespace Examples.AspNet

    ' Create a designer class for the SimpleDataList class.
    <System.Security.Permissions.SecurityPermission( _
    System.Security.Permissions.SecurityAction.Demand, _
    Flags:=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)> _
    Public Class SimpleDataListDesigner
        Inherits DataListDesigner

        Private simpleList As SimpleDataList


        ' Override the GetDesignTimeHtml method to add style to the control 
        ' on the design surface. 
        Public Overrides Function GetDesignTimeHtml() As String 
            ' Cast the control to the Component property of the designer.
            simpleList = CType(Component, SimpleDataList)

            Dim designTimeHtml As String = Nothing 

            ' Create variables to hold current property values. 
            Dim oldBorderWidth As Unit = simpleList.BorderWidth
            Dim oldBorderColor As Color = simpleList.BorderColor

            ' Set the properties and generate the design-time HTML. 
            If (simpleList.Enabled) Then 
                Try
                    simpleList.BorderWidth = Unit.Point(5)
                    simpleList.BorderColor = Color.Purple
                    designTimeHtml = MyBase.GetDesignTimeHtml()

                    ' Call the GetErrorDesignTimeHtml method if an 
                    ' exception occurs. 
                Catch ex As Exception
                    designTimeHtml = GetErrorDesignTimeHtml(ex)

                    ' Return the properties to their original settings. 
                Finally
                    simpleList.BorderWidth = oldBorderWidth
                    simpleList.BorderColor = oldBorderColor
                End Try 
                ' If the list is not enabled, call the GetEmptyDesignTimeHtml 
                ' method. 
            Else
                designTimeHtml = GetEmptyDesignTimeHtml()
            End If 

            Return designTimeHtml

        End Function 

        Protected Overrides Function GetEmptyDesignTimeHtml() As String 
            Dim emptyText As String 

            ' Check the CanEnterTemplateMode property to 
            ' specify which text to display if ItemTemplate  
            ' does not contain a value. 
            If CanEnterTemplateMode Then
                emptyText = _
                    "<b>Either the Enabled property value is false " + _
                    "or you need to set the ItemTemplate for this " + _
                    "control.<br>Right-click to edit templates.</b>" 
            Else
                emptyText = _
                    "<b>You cannot edit templates in this view.<br>" + _
                    "Switch to HTML view to define the ItemTemplate.</b>" 
            End If 

            Return CreatePlaceHolderDesignTimeHtml(emptyText)
        End Function 

        ' Generate HTML to indicate that an error has occurred. 
        Protected Overrides Function GetErrorDesignTimeHtml(ByVal exc As _
            Exception) As String 

            Return CreatePlaceHolderDesignTimeHtml( _
                "<b>An error occurred</b>.<br>Check to ensure that all " + _
                "properties are valid.")
        End Function 


        ' Override the Initialize method to ensure that 
        ' only an instance of the SimpleDataList class is 
        ' used by this designer class. 
        Public Overrides Sub Initialize(ByVal component As IComponent)
            simpleList = CType(component, SimpleDataList)

            If IsNothing(simpleList) Then 
                Throw New ArgumentException("Must be a SimpleDataList.", "component")
            End If 

            MyBase.Initialize(component)
        End Sub 
    End Class 
End Namespace

The following example shows how to use the DesignerAttribute attribute to associate the designer with the DataGrid control.

' Override the Initialize method to ensure that 
' only an instance of the SimpleDataList class is 
' used by this designer class. 
Public Overrides Sub Initialize(ByVal component As IComponent)
    simpleList = CType(component, SimpleDataList)

    If IsNothing(simpleList) Then 
        Throw New ArgumentException("Must be a SimpleDataList.", "component")
    End If 

    MyBase.Initialize(component)
End Sub

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

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