Επεξεργασία

Κοινή χρήση μέσω


DataListDesigner Class

Definition

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

public ref class DataListDesigner : System::Web::UI::Design::WebControls::BaseDataListDesigner
public class DataListDesigner : System.Web.UI.Design.WebControls.BaseDataListDesigner
[System.Web.UI.Design.SupportsPreviewControl(true)]
public class DataListDesigner : System.Web.UI.Design.WebControls.BaseDataListDesigner
type DataListDesigner = class
    inherit BaseDataListDesigner
[<System.Web.UI.Design.SupportsPreviewControl(true)>]
type DataListDesigner = class
    inherit BaseDataListDesigner
Public Class DataListDesigner
Inherits BaseDataListDesigner
Inheritance
Attributes

Examples

The following code example demonstrates how to extend the DataListDesigner class. The code overrides the GetDesignTimeHtml method to display a five-point border that is purple if the DataList control is enabled.

using System;
using System.Drawing;
using System.Security.Permissions;
using System.ComponentModel;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
namespace ASPNET.Examples.CS
{
    [SecurityPermission( 
    SecurityAction.Demand, 
    Flags = SecurityPermissionFlag.UnmanagedCode)] 
    public class SimpleGridViewDesigner : GridViewDesigner
    {
        private SimpleGridView simpleGView;

        public override string GetDesignTimeHtml()
        {
            string designTimeHtml = String.Empty;

            simpleGView = (SimpleGridView)Component;

            // Check the control's BorderStyle property to  
            // conditionally render design-time HTML.
            if (simpleGView.BorderStyle == BorderStyle.NotSet)
            {
                // Save the current property settings in variables.
                int oldCellPadding = simpleGView.CellPadding;
                Unit oldBorderWidth = simpleGView.BorderWidth;
                Color oldBorderColor = simpleGView.BorderColor;

                // Set properties and generate the design-time HTML.
                try
                {
                    simpleGView.Caption = "SimpleGridView";
                    simpleGView.CellPadding = 1;
                    simpleGView.BorderWidth = Unit.Pixel(3);
                    simpleGView.BorderColor = Color.Red;

                    designTimeHtml = base.GetDesignTimeHtml();
                }
                catch (Exception ex)
                {
                    // Get HTML from the GetErrorDesignTimeHtml 
                    // method if an exception occurs.
                    designTimeHtml = GetErrorDesignTimeHtml(ex);

                    // Return the properties to their original values.
                }
                finally
                {
                    simpleGView.CellPadding = oldCellPadding;
                    simpleGView.BorderWidth = oldBorderWidth;
                    simpleGView.BorderColor = oldBorderColor;
                }
            }
            else
            {
                designTimeHtml = base.GetDesignTimeHtml();
            }

            return designTimeHtml;
        }

        protected override string
            GetErrorDesignTimeHtml(System.Exception exc)
        {
            return CreatePlaceHolderDesignTimeHtml(
                "ASPNET.Examples: An error occurred while rendering the GridView.");
        }

        public override void Initialize(IComponent component)
        {
            simpleGView = (SimpleGridView)component;
            base.Initialize(component);
        }
    }
}
Imports System.Drawing
Imports System.ComponentModel
Imports System.Web.UI.WebControls
Imports System.Security
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls

Namespace ASPNET.Examples
    < _
        Designer("ASPNET.Examples.Design.SimpleGridViewDesigner", _
            "System.Web.UI.Design.GridViewDesigner") _
    > _
    Public Class SimpleGridView
        Inherits GridView

        ' Code to customize your GridView goes here

    End Class
End Namespace

Namespace ASPNET.Examples.Design
    <Permissions.SecurityPermission( _
    Permissions.SecurityAction.Demand, _
    Flags:=Permissions.SecurityPermissionFlag.UnmanagedCode)> _
    Public Class SimpleGridViewDesigner
        Inherits GridViewDesigner

        Private simpleGView As SimpleGridView

        Public Overrides Function GetDesignTimeHtml() As String
            Dim designTimeHtml As String = String.Empty

            simpleGView = CType(Component, SimpleGridView)

            ' Check the control's BorderStyle property to  
            ' conditionally render design-time HTML.
            If (simpleGView.BorderStyle = BorderStyle.NotSet) Then
                ' Save the current property settings in variables.
                Dim oldCellPadding As Integer = simpleGView.CellPadding
                Dim oldBorderWidth As Unit = simpleGView.BorderWidth
                Dim oldBorderColor As Color = simpleGView.BorderColor

                ' Set properties and generate the design-time HTML.
                Try
                    simpleGView.Caption = "SimpleGridView"
                    simpleGView.CellPadding = 1
                    simpleGView.BorderWidth = Unit.Pixel(3)
                    simpleGView.BorderColor = Color.Red

                    designTimeHtml = MyBase.GetDesignTimeHtml()

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

                    ' Return the properties to their original values.
                Finally
                    simpleGView.CellPadding = oldCellPadding
                    simpleGView.BorderWidth = oldBorderWidth
                    simpleGView.BorderColor = oldBorderColor
                End Try

            Else
                designTimeHtml = MyBase.GetDesignTimeHtml()
            End If

            Return designTimeHtml
        End Function

        Protected Overrides Function _
            GetErrorDesignTimeHtml(ByVal exc As Exception) As String

            Return CreatePlaceHolderDesignTimeHtml( _
                "ASPNET.Examples: An error occurred while rendering the GridView.")

        End Function

        Public Overrides Sub Initialize(ByVal component As IComponent)

            simpleGView = CType(component, SimpleGridView)

            MyBase.Initialize(component)

        End Sub
    End Class
End Namespace

The following code example shows how to use the DesignerAttribute to associate the designer with the DataList control.

[ Designer("ASPNET.Examples.Design.SimpleGridViewDesigner", 
        "System.Web.UI.Design.GridViewDesigner")]
public class SimpleGridView : GridView
{
    // Code to customize your GridView goes here
}
< _
    Designer("ASPNET.Examples.Design.SimpleGridViewDesigner", _
        "System.Web.UI.Design.GridViewDesigner") _
> _
Public Class SimpleGridView
    Inherits GridView

    ' Code to customize your GridView goes here

End Class

Constructors

DataListDesigner()

Initializes a new instance of the DataListDesigner class.

Properties

ActionLists

Gets the designer action list collection for this designer.

(Inherited from BaseDataListDesigner)
ActiveTemplateEditingFrame
Obsolete.

Gets the active template editing frame.

(Inherited from TemplatedControlDesigner)
AllowResize

Gets a value indicating whether the DataList control can be resized.

AssociatedComponents

Gets the collection of components associated with the component managed by the designer.

(Inherited from ComponentDesigner)
AutoFormats

Gets the DesignerAutoFormatCollection object associated with this designer.

AutoFormats

Gets the collection of predefined automatic formatting schemes to display in the Auto Format dialog box for the associated control at design time.

(Inherited from ControlDesigner)
Behavior
Obsolete.

Gets or sets the DHTML behavior that is associated with the designer.

(Inherited from HtmlControlDesigner)
CanEnterTemplateMode

Gets a value indicating whether or not this designer will allow the viewing or editing of templates.

(Inherited from TemplatedControlDesigner)
Component

Gets the component this designer is designing.

(Inherited from ComponentDesigner)
DataBindings

Gets the data bindings collection for the current control.

(Inherited from HtmlControlDesigner)
DataBindingsEnabled

Gets a value indicating whether the designer allows data binding.

(Inherited from TemplatedControlDesigner)
DataKeyField

Gets or sets the value of the data key field of the associated control.

(Inherited from BaseDataListDesigner)
DataMember

Gets or sets the value of the data member field of the associated control.

(Inherited from BaseDataListDesigner)
DataSource

Gets or sets the value of the data source property of the associated control.

(Inherited from BaseDataListDesigner)
DataSourceDesigner

Gets the designer of the data source, when one is selected for data binding.

(Inherited from BaseDataListDesigner)
DataSourceID

Gets 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)
DesignerState

Gets an object that is used to persist data for the associated control at design time.

(Inherited from ControlDesigner)
DesignerView

Gets the default view of the data source that is bound to the associated control.

(Inherited from BaseDataListDesigner)
DesignTimeElement
Obsolete.

Gets the design-time object representing the control that is associated with the HtmlControlDesigner object on the design surface.

(Inherited from HtmlControlDesigner)
DesignTimeElementView
Obsolete.

Gets the view-control object for the control designer.

(Inherited from ControlDesigner)
DesignTimeHtmlRequiresLoadComplete

Gets a value indicating whether loading must be complete to display the design-time markup.

(Inherited from BaseDataListDesigner)
Expressions

Gets the expression bindings for the current control at design time.

(Inherited from HtmlControlDesigner)
HidePropertiesInTemplateMode

Gets a value indicating whether the properties of the control will be hidden when the control is placed into template editing mode.

(Inherited from TemplatedControlDesigner)
ID

Gets or sets the ID string for the control.

(Inherited from ControlDesigner)
InheritanceAttribute

Gets an attribute that indicates the type of inheritance of the associated component.

(Inherited from ComponentDesigner)
Inherited

Gets a value indicating whether this component is inherited.

(Inherited from ComponentDesigner)
InTemplateMode
Obsolete.

Gets a value indicating whether the designer document is in template mode.

(Inherited from TemplatedControlDesigner)
IsDirty
Obsolete.

Gets or sets a value indicating whether the Web server control has been marked as changed.

(Inherited from ControlDesigner)
ParentComponent

Gets the parent component for this designer.

(Inherited from ComponentDesigner)
ReadOnly
Obsolete.

Gets or sets a value indicating whether the properties of the control are read-only at design time.

(Inherited from ControlDesigner)
RootDesigner

Gets the control designer for the Web Forms page that contains the associated control.

(Inherited from ControlDesigner)
SetTextualDefaultProperty (Inherited from ComponentDesigner)
ShadowProperties

Gets a collection of property values that override user settings.

(Inherited from ComponentDesigner)
ShouldCodeSerialize
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)
Tag

Gets an object representing the HTML markup element for the associated control.

(Inherited from ControlDesigner)
TemplateGroups

Gets a collection of template groups, each containing a template definition.

(Inherited from TemplatedControlDesigner)
TemplatesExist

Gets a value indicating whether there are templates defined for the associated control.

UsePreviewControl

Gets a value indicating whether the control designer uses a temporary preview control to generate the design-time HTML markup.

(Inherited from ControlDesigner)
Verbs

Gets the collection of verbs available to this designer.

(Inherited from BaseDataListDesigner)
ViewControl

Gets or sets a Web server control that can be used for previewing the design-time HTML markup.

(Inherited from ControlDesigner)
ViewControlCreated

Gets or sets a value indicating whether a View control has been created for display on the design surface.

(Inherited from ControlDesigner)
Visible

Gets a value that indicates whether the control is visible at design time.

(Inherited from ControlDesigner)

Methods

CreateErrorDesignTimeHtml(String, Exception)

Creates the HTML markup to display a specified exception error message at design time.

(Inherited from ControlDesigner)
CreateErrorDesignTimeHtml(String)

Creates HTML markup to display a specified error message at design time.

(Inherited from ControlDesigner)
CreatePlaceHolderDesignTimeHtml()

Provides a simple rectangular placeholder representation that displays the type and ID of the control.

(Inherited from ControlDesigner)
CreatePlaceHolderDesignTimeHtml(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)
CreateTemplateEditingFrame(TemplateEditingVerb)
Obsolete.

Creates a template editing frame using the specified verb.

CreateViewControl()

Returns a copy of the associated control for viewing or rendering on the design surface.

(Inherited from ControlDesigner)
Dispose()

Releases all resources used by the ComponentDesigner.

(Inherited from ComponentDesigner)
Dispose(Boolean)

Releases the unmanaged resources used by the DataListDesigner object and optionally releases the managed resources.

DoDefaultAction()

Creates 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)
EnterTemplateMode(ITemplateEditingFrame)
Obsolete.

Opens a particular template frame object for editing in the designer.

(Inherited from TemplatedControlDesigner)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExitTemplateMode(Boolean, Boolean, Boolean)
Obsolete.

Closes the currently active template editing frame after saving any relevant changes.

(Inherited from TemplatedControlDesigner)
GetBounds()

Retrieves the coordinates of the rectangle representing the boundaries for the control as displayed on the design surface.

(Inherited from ControlDesigner)
GetCachedTemplateEditingVerbs()
Obsolete.

Gets the cached template editing verbs available to the designer.

GetDesignTimeDataSource(IEnumerable, Int32, Boolean)

Generates an object that can be used as a data source at design time.

(Inherited from BaseDataListDesigner)
GetDesignTimeDataSource(Int32, Boolean)

Generates an object that can be used as a data source at design time.

(Inherited from BaseDataListDesigner)
GetDesignTimeHtml()

Gets the HTML used to represent the DataList control at design time.

GetDesignTimeHtml(DesignerRegionCollection)

Retrieves the HTML markup to display the control and populates the collection with the current control designer regions.

(Inherited from ControlDesigner)
GetEditableDesignerRegionContent(EditableDesignerRegion)

Returns the content for an editable region of the design-time view of the associated control.

(Inherited from ControlDesigner)
GetEmptyDesignTimeHtml()

Gets the HTML used to represent an empty template-based control at design time.

GetErrorDesignTimeHtml(Exception)

Gets the HTML to display at design time for the specified exception when an error has been encountered while rendering the control.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetPersistenceContent()

Retrieves the persistable inner HTML markup of the control at design time.

(Inherited from ControlDesigner)
GetPersistInnerHtml()

Gets the markup to persist for the content that is in the associated server control runtime.

(Inherited from TemplatedControlDesigner)
GetResolvedSelectedDataSource()

Gets the data source component from the associated control container, resolved to a specific data member.

(Inherited from BaseDataListDesigner)
GetSelectedDataSource()

Gets the data source component from the associated control container.

(Inherited from BaseDataListDesigner)
GetService(Type)

Attempts to retrieve the specified type of service from the design mode site of the designer's component.

(Inherited from ComponentDesigner)
GetTemplateContainerDataItemProperty(String)
Obsolete.

Gets the IDataItemContainer.DataItem property of the template container.

GetTemplateContainerDataSource(String)
Obsolete.

Gets the data source of the template's container.

(Inherited from BaseDataListDesigner)
GetTemplateContent(ITemplateEditingFrame, String, Boolean)
Obsolete.

Gets the content of the template.

GetTemplateEditingVerbs()
Obsolete.

Gets the template editing verbs available to the designer.

(Inherited from TemplatedControlDesigner)
GetTemplateFromText(String)

Creates a template from the specified text.

(Inherited from TemplatedControlDesigner)
GetTemplatePropertyParentType(String)
Obsolete.

Gets the type of the parent of the template property.

(Inherited from TemplatedControlDesigner)
GetTextFromTemplate(ITemplate)

Gets a string of text that represents the specified template.

(Inherited from TemplatedControlDesigner)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetViewRendering()

Retrieves an object that contains the design-time markup for the content and regions of the associated control.

(Inherited from ControlDesigner)
Initialize(IComponent)

Initializes the designer with the specified component.

InitializeExistingComponent(IDictionary)

Reinitializes an existing component.

(Inherited from ComponentDesigner)
InitializeNewComponent(IDictionary)

Initializes a newly created component.

(Inherited from ComponentDesigner)
InitializeNonDefault()
Obsolete.
Obsolete.

Initializes the settings for an imported component that is already initialized to settings other than the defaults.

(Inherited from ComponentDesigner)
Invalidate()

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)
Invalidate(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)
InvokeGetInheritanceAttribute(ComponentDesigner)

Gets the InheritanceAttribute of the specified ComponentDesigner.

(Inherited from ComponentDesigner)
InvokePropertyBuilder(Int32)

Invokes a component editor for the associated control.

(Inherited from BaseDataListDesigner)
IsPropertyBound(String)
Obsolete.

Retrieves a value indicating whether the specified property on the associated control is data-bound.

(Inherited from ControlDesigner)
Localize(IDesignTimeResourceWriter)

Uses the provided resource writer to persist the localizable properties of the associated control to a resource in the design host.

(Inherited from ControlDesigner)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnAutoFormat(Object, EventArgs)
Obsolete.

Handles the AutoFormat event.

(Inherited from BaseDataListDesigner)
OnAutoFormatApplied(DesignerAutoFormat)

Called when an automatic formatting scheme has been applied to the associated control.

(Inherited from BaseDataListDesigner)
OnBehaviorAttached()
Obsolete.

Provides an opportunity to perform additional processing when a behavior is attached to the designer.

(Inherited from TemplatedControlDesigner)
OnBehaviorDetaching()
Obsolete.

Called when a behavior disassociates from the element.

(Inherited from HtmlControlDesigner)
OnBindingsCollectionChanged(String)
Obsolete.

Called when the data-binding collection changes.

(Inherited from ControlDesigner)
OnClick(DesignerRegionMouseEventArgs)

Called by the design host when the user clicks the associated control at design time.

(Inherited from ControlDesigner)
OnComponentChanged(Object, ComponentChangedEventArgs)

Called when there is a change to the associated control.

(Inherited from BaseDataListDesigner)
OnComponentChanging(Object, ComponentChangingEventArgs)

Represents the method that will handle the ComponentChanging event for the associated control.

(Inherited from ControlDesigner)
OnControlResize()
Obsolete.

Called when the associated Web server control has been resized in the design host at design time.

(Inherited from ControlDesigner)
OnDataSourceChanged()

Called when the data source for the associated control has changed.

(Inherited from BaseDataListDesigner)
OnPaint(PaintEventArgs)

Called when the control designer draws the associated control on the design surface, if the CustomPaint value is true.

(Inherited from ControlDesigner)
OnPropertyBuilder(Object, EventArgs)

Represents the method that handles the property-builder event.

(Inherited from BaseDataListDesigner)
OnSchemaRefreshed()

Called when the data source to which the underlying control is bound loads a new schema.

OnSchemaRefreshed()

Called when the schema of the data source for the associated control changes.

(Inherited from BaseDataListDesigner)
OnSetComponentDefaults()
Obsolete.
Obsolete.

Sets the default properties for the component.

(Inherited from ComponentDesigner)
OnSetParent()

Provides an opportunity to perform additional processing when the parent of this designer is changed.

(Inherited from TemplatedControlDesigner)
OnStylesChanged()

Can be overridden to implement functionality that should occur when a style of the associated control has changed.

(Inherited from BaseDataListDesigner)
OnTemplateEditingVerbsChanged()

Called when the template editing verbs change.

OnTemplateModeChanged()

Provides an opportunity to perform additional processing when the template mode is changed.

(Inherited from TemplatedControlDesigner)
PostFilterAttributes(IDictionary)

Allows a designer to change or remove items from the set of attributes that it exposes through a TypeDescriptor.

(Inherited from ComponentDesigner)
PostFilterEvents(IDictionary)

Allows a designer to change or remove items from the set of events that it exposes through a TypeDescriptor.

(Inherited from ComponentDesigner)
PostFilterProperties(IDictionary)

Allows a designer to change or remove items from the set of properties that it exposes through a TypeDescriptor.

(Inherited from ComponentDesigner)
PreFilterAttributes(IDictionary)

Allows a designer to add to the set of attributes that it exposes through a TypeDescriptor.

(Inherited from ComponentDesigner)
PreFilterEvents(IDictionary)

Sets the list of events that are exposed at design-time for the TypeDescriptor object for the component.

(Inherited from HtmlControlDesigner)
PreFilterProperties(IDictionary)

Used 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)
RaiseComponentChanged(MemberDescriptor, Object, Object)

Notifies the IComponentChangeService that this component has been changed.

(Inherited from ComponentDesigner)
RaiseComponentChanging(MemberDescriptor)

Notifies the IComponentChangeService that this component is about to be changed.

(Inherited from ComponentDesigner)
RaiseResizeEvent()
Obsolete.

Raises the OnControlResize() event.

(Inherited from ControlDesigner)
RegisterClone(Object, Object)

Registers internal data in a cloned control.

(Inherited from ControlDesigner)
SaveActiveTemplateEditingFrame()

Saves the active template editing frame.

(Inherited from TemplatedControlDesigner)
SetEditableDesignerRegionContent(EditableDesignerRegion, String)

Specifies the content for an editable region of the control at design time.

(Inherited from ControlDesigner)
SetRegionContent(EditableDesignerRegion, String)

Specifies the content for an editable region in the design-time view of the control.

(Inherited from ControlDesigner)
SetTemplateContent(ITemplateEditingFrame, String, String)
Obsolete.

Sets the content for the specified template and frame.

SetViewFlags(ViewFlags, Boolean)

Assigns the specified bitwise ViewFlags enumeration to the specified flag value.

(Inherited from ControlDesigner)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
UpdateDesignTimeHtml()

Updates the design-time HTML.

(Inherited from TemplatedControlDesigner)

Explicit Interface Implementations

IDataBindingSchemaProvider.CanRefreshSchema

For a description of this member, see CanRefreshSchema.

(Inherited from BaseDataListDesigner)
IDataBindingSchemaProvider.RefreshSchema(Boolean)

For a description of this member, see RefreshSchema(Boolean).

(Inherited from BaseDataListDesigner)
IDataBindingSchemaProvider.Schema

For a description of this member, see Schema.

(Inherited from BaseDataListDesigner)
IDesignerFilter.PostFilterAttributes(IDictionary)

For a description of this member, see the PostFilterAttributes(IDictionary) method.

(Inherited from ComponentDesigner)
IDesignerFilter.PostFilterEvents(IDictionary)

For a description of this member, see the PostFilterEvents(IDictionary) method.

(Inherited from ComponentDesigner)
IDesignerFilter.PostFilterProperties(IDictionary)

For a description of this member, see the PostFilterProperties(IDictionary) method.

(Inherited from ComponentDesigner)
IDesignerFilter.PreFilterAttributes(IDictionary)

For a description of this member, see the PreFilterAttributes(IDictionary) method.

(Inherited from ComponentDesigner)
IDesignerFilter.PreFilterEvents(IDictionary)

For a description of this member, see the PreFilterEvents(IDictionary) method.

(Inherited from ComponentDesigner)
IDesignerFilter.PreFilterProperties(IDictionary)

For a description of this member, see the PreFilterProperties(IDictionary) method.

(Inherited from ComponentDesigner)
ITreeDesigner.Children

For a description of this member, see the Children property.

(Inherited from ComponentDesigner)
ITreeDesigner.Parent

For a description of this member, see the Parent property.

(Inherited from ComponentDesigner)

Applies to

See also