This topic has not yet been rated - Rate this topic

ObjectDataSourceDesigner Class

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

System.Object
  System.ComponentModel.Design.ComponentDesigner
    System.Web.UI.Design.HtmlControlDesigner
      System.Web.UI.Design.ControlDesigner
        System.Web.UI.Design.DataSourceDesigner
          System.Web.UI.Design.WebControls.ObjectDataSourceDesigner

Namespace:  System.Web.UI.Design.WebControls
Assembly:  System.Design (in System.Design.dll)
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public class ObjectDataSourceDesigner : DataSourceDesigner

The ObjectDataSourceDesigner type exposes the following members.

  Name Description
Public method ObjectDataSourceDesigner Infrastructure. Initializes a new instance of the ObjectDataSourceDesigner class.
Top
  Name Description
Public property ActionLists Gets a list of items that are used to create an action list menu at design time. (Inherited from DataSourceDesigner.)
Public property AllowResize Gets a value indicating whether the control can be resized in the design-time environment. (Inherited from ControlDesigner.)
Public property AssociatedComponents Gets the collection of components associated with the component managed by the designer. (Inherited from ComponentDesigner.)
Public property 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.)
Public property Behavior Obsolete. Gets or sets the DHTML behavior that is associated with the designer. (Inherited from HtmlControlDesigner.)
Public property CanConfigure Gets a value that indicates whether the Configure method can be called. (Overrides DataSourceDesigner.CanConfigure.)
Public property CanRefreshSchema Gets a value that indicates whether the RefreshSchema method can be called. (Overrides DataSourceDesigner.CanRefreshSchema.)
Public property Component Gets the component this designer is designing. (Inherited from ComponentDesigner.)
Public property DataBindings Gets the data bindings collection for the current control. (Inherited from HtmlControlDesigner.)
Protected property DataBindingsEnabled Gets a value indicating whether data binding is supported by the containing region for the associated control. (Inherited from ControlDesigner.)
Protected property DesignerState Gets an object that is used to persist data for the associated control at design time. (Inherited from ControlDesigner.)
Protected property DesignTimeElement Obsolete. Gets the design-time object representing the control that is associated with the HtmlControlDesigner object on the design surface. (Inherited from HtmlControlDesigner.)
Protected property DesignTimeElementView Obsolete. Gets the view-control object for the control designer. (Inherited from ControlDesigner.)
Public property DesignTimeHtmlRequiresLoadComplete Obsolete. Gets a value indicating whether the design host must finish loading before the GetDesignTimeHtml method can be called. (Inherited from ControlDesigner.)
Public property Expressions Gets the expression bindings for the current control at design time. (Inherited from HtmlControlDesigner.)
Protected property HidePropertiesInTemplateMode Infrastructure. Gets a value indicating whether the properties of the associated control are hidden when the control is in template mode. (Inherited from ControlDesigner.)
Public property ID Gets or sets the ID string for the control. (Inherited from ControlDesigner.)
Protected property InheritanceAttribute Gets an attribute that indicates the type of inheritance of the associated component. (Inherited from ComponentDesigner.)
Protected property Inherited Gets a value indicating whether this component is inherited. (Inherited from ComponentDesigner.)
Protected property InTemplateMode Gets a value indicating whether the control is in either template viewing or editing mode in the design host. The InTemplateMode property is read-only. (Inherited from ControlDesigner.)
Public property IsDirty Obsolete. Gets or sets a value indicating whether the Web server control has been marked as changed. (Inherited from ControlDesigner.)
Protected property ParentComponent Gets the parent component for this designer. (Inherited from ComponentDesigner.)
Public property ReadOnly Obsolete. Gets or sets a value indicating whether the properties of the control are read-only at design time. (Inherited from ControlDesigner.)
Protected property RootDesigner Gets the control designer for the Web Forms page that contains the associated control. (Inherited from ControlDesigner.)
Public property SelectMethod Gets or sets the name of the method to execute when the Select method of the associated control is called.
Protected property ShadowProperties Gets a collection of property values that override user settings. (Inherited from ComponentDesigner.)
Public property 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.)
Protected property SuppressingDataSourceEvents Gets a value indicating whether the DataSourceChanged event or the RefreshSchema method occurs. (Inherited from DataSourceDesigner.)
Protected property Tag Gets an object representing the HTML markup element for the associated control. (Inherited from ControlDesigner.)
Public property TemplateGroups Gets a collection of template groups, each containing one or more template definitions. (Inherited from ControlDesigner.)
Public property TypeName Gets or sets the name of the type that contains the methods that are specified in the associated control.
Protected property UsePreviewControl Gets a value indicating whether the control designer uses a temporary preview control to generate the design-time HTML markup. (Inherited from ControlDesigner.)
Public property Verbs Gets the design-time verbs supported by the component that is associated with the designer. (Inherited from ComponentDesigner.)
Public property ViewControl Gets or sets a Web server control that can be used for previewing the design-time HTML markup. (Inherited from ControlDesigner.)
Public property ViewControlCreated Gets or sets a value indicating whether a View control has been created for display on the design surface. (Inherited from ControlDesigner.)
Protected property Visible Gets a value that indicates whether the control is visible at design time. (Inherited from ControlDesigner.)
Top
  Name Description
Public method Configure Displays the Configure Data Source wizard on the visual designer surface. (Overrides DataSourceDesigner.Configure().)
Protected method CreateErrorDesignTimeHtml(String) Creates HTML markup to display a specified error message at design time. (Inherited from ControlDesigner.)
Protected method CreateErrorDesignTimeHtml(String, Exception) Creates the HTML markup to display a specified exception error message at design time. (Inherited from ControlDesigner.)
Protected method CreatePlaceHolderDesignTimeHtml() Provides a simple rectangular placeholder representation that displays the type and ID of the control. (Inherited from ControlDesigner.)
Protected method 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.)
Protected method CreateViewControl Returns a copy of the associated control for viewing or rendering on the design surface. (Inherited from ControlDesigner.)
Public method Dispose() Releases all resources used by the ComponentDesigner. (Inherited from ComponentDesigner.)
Protected method Dispose(Boolean) Releases the unmanaged resources that are used by the HtmlControlDesigner object and optionally releases the managed resources. (Inherited from HtmlControlDesigner.)
Public method 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.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Attempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection. (Inherited from ComponentDesigner.)
Public method GetBounds Retrieves the coordinates of the rectangle representing the boundaries for the control as displayed on the design surface. (Inherited from ControlDesigner.)
Public method GetDesignTimeHtml() Retrieves the HTML markup for displaying the associated data source control at design time. (Inherited from DataSourceDesigner.)
Public method GetDesignTimeHtml(DesignerRegionCollection) Retrieves the HTML markup to display the control and populates the collection with the current control designer regions. (Inherited from ControlDesigner.)
Public method GetEditableDesignerRegionContent Returns the content for an editable region of the design-time view of the associated control. (Inherited from ControlDesigner.)
Protected method GetEmptyDesignTimeHtml Retrieves the HTML markup to represent a Web server control at design time that will have no visual representation at run time. (Inherited from ControlDesigner.)
Protected method GetErrorDesignTimeHtml Retrieves the HTML markup that provides information about the specified exception. (Inherited from ControlDesigner.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetPersistenceContent Retrieves the persistable inner HTML markup of the control at design time. (Inherited from ControlDesigner.)
Public method GetPersistInnerHtml Obsolete. Retrieves the persistable inner HTML markup of the control. (Inherited from ControlDesigner.)
Protected method GetService Attempts to retrieve the specified type of service from the design mode site of the designer's component. (Inherited from ComponentDesigner.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetView Returns a data source view with the specified name. (Overrides DataSourceDesigner.GetView(String).)
Public method GetViewNames Returns a list of data source view names for the associated control. (Overrides DataSourceDesigner.GetViewNames().)
Public method GetViewRendering() Retrieves an object that contains the design-time markup for the content and regions of the associated control. (Inherited from ControlDesigner.)
Public method Initialize Initializes the control designer and loads the specified component. (Inherited from ControlDesigner.)
Public method InitializeExistingComponent Reinitializes an existing component. (Inherited from ComponentDesigner.)
Public method InitializeNewComponent Initializes a newly created component. (Inherited from ComponentDesigner.)
Public method InitializeNonDefault Obsolete. Initializes the settings for an imported component that is already initialized to settings other than the defaults. (Inherited from ComponentDesigner.)
Public method 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.)
Public method 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.)
Protected method InvokeGetInheritanceAttribute Gets the InheritanceAttribute of the specified ComponentDesigner. (Inherited from ComponentDesigner.)
Public method IsPropertyBound Obsolete. Retrieves a value indicating whether the specified property on the associated control is data-bound. (Inherited from ControlDesigner.)
Public method Localize Uses the provided resource writer to persist the localizable properties of the associated control to a resource in the design host. (Inherited from ControlDesigner.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method OnAutoFormatApplied Called when a predefined, automatic formatting scheme has been applied to the associated control. (Inherited from ControlDesigner.)
Protected method OnBehaviorAttached Obsolete. Called when a behavior is associated with the element. (Inherited from HtmlControlDesigner.)
Protected method OnBehaviorDetaching Obsolete. Called when a behavior disassociates from the element. (Inherited from HtmlControlDesigner.)
Protected method OnBindingsCollectionChanged Obsolete. Called when the data-binding collection changes. (Inherited from ControlDesigner.)
Protected method OnClick Called by the design host when the user clicks the associated control at design time. (Inherited from ControlDesigner.)
Public method OnComponentChanged Called when the associated control changes. (Inherited from ControlDesigner.)
Public method OnComponentChanging Represents the method that will handle the ComponentChanging event for the associated control. (Inherited from ControlDesigner.)
Protected method OnControlResize Obsolete. Called when the associated Web server control has been resized in the design host at design time. (Inherited from ControlDesigner.)
Protected method OnDataSourceChanged Raises the DataSourceChanged event when the properties of the data source have changed and the SuppressingDataSourceEvents value is false. (Inherited from DataSourceDesigner.)
Protected method OnPaint Called when the control designer draws the associated control on the design surface, if the CustomPaint value is true. (Inherited from ControlDesigner.)
Protected method OnSchemaRefreshed Raises the SchemaRefreshed event when the schema of the data source has changed and the SuppressingDataSourceEvents value is false. (Inherited from DataSourceDesigner.)
Public method OnSetComponentDefaults Obsolete. Sets the default properties for the component. (Inherited from ComponentDesigner.)
Public method OnSetParent Provides a way to perform additional processing when the associated control is attached to a parent control. (Inherited from HtmlControlDesigner.)
Protected method PostFilterAttributes Allows a designer to change or remove items from the set of attributes that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected method PostFilterEvents Allows a designer to change or remove items from the set of events that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected method PostFilterProperties Allows a designer to change or remove items from the set of properties that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected method PreFilterAttributes Allows a designer to add to the set of attributes that it exposes through a TypeDescriptor. (Inherited from ComponentDesigner.)
Protected method PreFilterEvents Sets the list of events that are exposed at design-time for the TypeDescriptor object for the component. (Inherited from HtmlControlDesigner.)
Protected method PreFilterProperties 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. (Overrides ControlDesigner.PreFilterProperties(IDictionary).)
Protected method RaiseComponentChanged Notifies the IComponentChangeService that this component has been changed. (Inherited from ComponentDesigner.)
Protected method RaiseComponentChanging Notifies the IComponentChangeService that this component is about to be changed. (Inherited from ComponentDesigner.)
Public method RaiseResizeEvent Obsolete. Raises the OnControlResize event. (Inherited from ControlDesigner.)
Public method RefreshSchema Extracts the metadata for the Select method from the business object that is specified by the associated control. (Overrides DataSourceDesigner.RefreshSchema(Boolean).)
Public method RegisterClone Registers internal data in a cloned control. (Inherited from ControlDesigner.)
Public method ResumeDataSourceEvents Restores data source events after the data source events have been suppressed. (Inherited from DataSourceDesigner.)
Public method SetEditableDesignerRegionContent Specifies the content for an editable region of the control at design time. (Inherited from ControlDesigner.)
Protected method SetRegionContent Specifies the content for an editable region in the design-time view of the control. (Inherited from ControlDesigner.)
Protected method SetViewFlags Assigns the specified bitwise ViewFlags enumeration to the specified flag value. (Inherited from ControlDesigner.)
Public method SuppressDataSourceEvents Postpones all data source events until after the ResumeDataSourceEvents method is called. (Inherited from DataSourceDesigner.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method UpdateDesignTimeHtml Refreshes the design-time HTML markup for the associated Web server control by calling the GetDesignTimeHtml method. (Inherited from ControlDesigner.)
Top
  Name Description
Public event DataSourceChanged Occurs when any property of the associated data source changes. (Inherited from DataSourceDesigner.)
Public event SchemaRefreshed Occurs after the schema has been refreshed. (Inherited from DataSourceDesigner.)
Top
  Name Description
Explicit interface implemetation Private method IDesignerFilter.PostFilterAttributes For a description of this member, see the IDesignerFilter.PostFilterAttributes method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private method IDesignerFilter.PostFilterEvents For a description of this member, see the IDesignerFilter.PostFilterEvents method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private method IDesignerFilter.PostFilterProperties For a description of this member, see the IDesignerFilter.PostFilterProperties method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private method IDesignerFilter.PreFilterAttributes For a description of this member, see the IDesignerFilter.PreFilterAttributes method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private method IDesignerFilter.PreFilterEvents For a description of this member, see the IDesignerFilter.PreFilterEvents method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private method IDesignerFilter.PreFilterProperties For a description of this member, see the IDesignerFilter.PreFilterProperties method. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private property ITreeDesigner.Children For a description of this member, see the ITreeDesigner.Children property. (Inherited from ComponentDesigner.)
Explicit interface implemetation Private property ITreeDesigner.Parent For a description of this member, see the ITreeDesigner.Parent property. (Inherited from ComponentDesigner.)
Top

The ObjectDataSource control represents a data source that calls methods of a business object in order to perform the Delete, Insert, Select, and Update database operations.

In a visual designer, when you switch from Source to Design view, the markup source code that describes the ObjectDataSource 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 ObjectDataSourceDesigner class provides design-time support for the ObjectDataSource control in a visual designer.

The ObjectDataSourceDesigner class members provide the following functionality:

  • The CanConfigure property indicates whether the Configure Data Source wizard can be displayed. The CanRefreshSchema property indicates whether the schema of the associated ObjectDataSource control can be refreshed at design time.

  • The SelectMethod property specifies the method that performs the Select function. The TypeName property specifies the type of the business object that provides the data for the associated control.

  • The GetView method returns a data source view with the specified name. The GetViewNames method returns a list of data source view names for the associated ObjectDataSource control. The RefreshSchema method extracts the metadata for the Select method from the associated business object.

  • The Configure method causes the Configure Data Source wizard to be displayed on the visual designer surface. The PreFilterProperties method removes properties from, adds additional properties to, or shadows properties of the associated control.

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

The example derives the MyObjectDataSource control from the ObjectDataSource. The MyObjectDataSource is a copy of the ObjectDataSource control. The example also derives the MyObjectDataSourceDesigner class from the ObjectDataSourceDesigner and applies a DesignerAttribute attribute for the MyObjectDataSourceDesigner on the MyObjectDataSource control.

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

The MyObjectDataSourceDesigner overrides the GetDesignTimeHtml method to display the TypeName and SelectMethod properties in a placeholder, in addition to the control type and ID.


using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;

namespace Examples.CS.WebControls.Design
{
    // The MyObjectDataSource is a copy of the ObjectDataSource.
    [AspNetHostingPermission(SecurityAction.Demand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(Examples.CS.WebControls.Design.
        MyObjectDataSourceDesigner))]
    public class MyObjectDataSource : ObjectDataSource
    {
    } // MyObjectDataSource

    // Derive a designer that inherits from the ObjectDataSourceDesigner.
    [ReflectionPermission(SecurityAction.Demand, Flags=ReflectionPermissionFlag.MemberAccess)]
    public class MyObjectDataSourceDesigner : ObjectDataSourceDesigner
    {
        // Generate the design-time markup.
        public override string GetDesignTimeHtml()
        {
            // Get a reference to the control or a copy of the control.
            MyObjectDataSource myODS = (MyObjectDataSource)ViewControl;

            // Create a placeholder that displays the type of the business 
            // object and the name of the Select method.
            string markup = CreatePlaceHolderDesignTimeHtml(
                 "<b>TypeName</b> \"" + myODS.TypeName + "\"<br />" + 
                 "<b>SelectMethod</b> \"" + myODS.SelectMethod + "\"" );

            return markup;

        } // GetDesignTimeHtml

        // Shadow the control properties with design-time properties.
        protected override void PreFilterProperties(IDictionary properties)
        {
            // Call the base method first.
            base.PreFilterProperties(properties);

            // Make the NamingContainer visible in the Properties grid.
            PropertyDescriptor selectProp =
                (PropertyDescriptor)properties["NamingContainer"];
            properties["NamingContainer"] =
                TypeDescriptor.CreateProperty(selectProp.ComponentType,
                    selectProp, BrowsableAttribute.Yes);
        } // PreFilterProperties

    } // MyObjectDataSourceDesigner
} // Examples.CS.WebControls.Design


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ