AccessDataSourceDesigner Class
Assembly: System.Design (in system.design.dll)
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 Overrides Sub PreFilterProperties(ByVal properties As IDictionary) ' Call the base class method first. MyBase.PreFilterProperties(properties) ' Add the ConnectionString property to the property grid. Dim prop As PropertyDescriptor prop = CType(properties("ConnectionString"), PropertyDescriptor) Dim atts(1) As Attribute atts(0) = New BrowsableAttribute(True) atts(1) = New ReadOnlyAttribute(True) properties("ConnectionString") = TypeDescriptor.CreateProperty( _ prop.GetType(), prop, atts) End Sub
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:=System.Web.AspNetHostingPermissionLevel.Minimal)> _ <AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, _ Level:=System.Web.AspNetHostingPermissionLevel.Minimal)> _ <Designer("CustomControls.Design.ExampleAccessDataSourceDesigner")> _ Public Class ExampleAccessDataSource Inherits AccessDataSource ' Does nothing extra End Class
- SecurityPermission for calling unmanaged code. Demand value: Demand. Permission value: UnmanagedCode
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.DataSourceDesigner
System.Web.UI.Design.WebControls.SqlDataSourceDesigner
System.Web.UI.Design.WebControls.AccessDataSourceDesigner