Export (0) Print
Expand All

AccessDataSourceDesigner Class

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

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

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public class AccessDataSourceDesigner : SqlDataSourceDesigner

In a visual designer, when you switch from Source to Design view, the markup source code that describes the AccessDataSource control is parsed and a design-time version of the control, which is just a placeholder, is created on the design surface. When you switch back to Source view, the design-time control, which includes the values of the properties in the Properties grid, is persisted to the markup source code and edited into the markup for the Web page.

This section provides two code examples. The first demonstrates how to extend the AccessDataSourceDesigner class. The second demonstrates how to derive a copy of the AccessDataSource class and associate it with a designer.

The following code example demonstrates how to extend the AccessDataSourceDesigner class. The code alters the placeholder that represents the control on the design surface and adds a property to the Properties grid.

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

    // Add the ConnectionString property to the property grid.
    PropertyDescriptor property =
        (PropertyDescriptor)properties["ConnectionString"];
    Attribute[] attributes = new Attribute[]
    {
        new BrowsableAttribute(true),
        new ReadOnlyAttribute(true)
    };
    properties["ConnectionString"] = TypeDescriptor.CreateProperty(
        GetType(), property, attributes);
}

The following code example demonstrates how to derive a copy of the AccessDataSource class and associate it with the designer that was defined in the preceding example.

// Create a control and bind it to the ExampleAccessDataSourceDesigner.
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
[Designer(typeof(CustomControls.Design.ExampleAccessDataSourceDesigner))]
public class ExampleAccessDataSource : AccessDataSource
{
    // Does nothing extra
}

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

Community Additions

ADD
Show:
© 2014 Microsoft