DataSourceDesigner Class
Provides design-time support in a design host for the DataSourceControl class.
Assembly: System.Design (in System.Design.dll)
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.DataSourceDesigner
System.Web.UI.Design.WebControls.EntityDataSourceDesigner
System.Web.UI.Design.WebControls.LinqDataSourceDesigner
System.Web.UI.Design.WebControls.ObjectDataSourceDesigner
System.Web.UI.Design.WebControls.SqlDataSourceDesigner
| Name | Description | |
|---|---|---|
![]() | DataSourceDesigner() | Initializes a new instance of the DataSourceDesigner class. |
| Name | Description | |
|---|---|---|
![]() | ActionLists | Gets a list of items that are used to create an action list menu at design time.(Overrides ControlDesigner.ActionLists.) |
![]() | AllowResize | Gets a value indicating whether the control can be resized in the design-time environment.(Inherited from ControlDesigner.) |
![]() | AssociatedComponents | Gets the collection of components associated with the component managed by the designer.(Inherited from ComponentDesigner.) |
![]() | 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.) |
![]() | CanConfigure | Gets a value indicating whether the Configure method can be called. |
![]() | CanRefreshSchema | Gets a value indicating whether the RefreshSchema method can be called. |
![]() | 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 data binding is supported by the containing region for the associated control.(Inherited from ControlDesigner.) |
![]() | DesignerState | Gets an object that is used to persist data for the associated control at design time.(Inherited from ControlDesigner.) |
![]() | 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 | Obsolete. Gets a value indicating whether the design host must finish loading before the GetDesignTimeHtml method can be called.(Inherited from ControlDesigner.) |
![]() | Expressions | Gets the expression bindings for the current control at design time.(Inherited from HtmlControlDesigner.) |
![]() | HidePropertiesInTemplateMode | This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value indicating whether the properties of the associated control are hidden when the control is in template mode.(Inherited from ControlDesigner.) |
![]() | 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 | 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.) |
![]() | 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.) |
![]() | 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.) |
![]() | SuppressingDataSourceEvents | Gets a value indicating whether the DataSourceChanged event or the RefreshSchema method occurs. |
![]() | 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 one or more template definitions.(Inherited from ControlDesigner.) |
![]() | 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 design-time verbs supported by the component that is associated with the designer.(Inherited from ComponentDesigner.) |
![]() | 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.) |
| Name | Description | |
|---|---|---|
![]() | Configure() | Launches the data source configuration utility in the design host. |
![]() | CreateErrorDesignTimeHtml(String) | Creates HTML markup to display a specified error message at design time.(Inherited from ControlDesigner.) |
![]() | CreateErrorDesignTimeHtml(String, Exception) | Creates the HTML markup to display a specified exception 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.) |
![]() | 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 that are used by the HtmlControlDesigner object and optionally releases the managed resources.(Inherited from HtmlControlDesigner.) |
![]() | 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.) |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Attempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection.(Inherited from ComponentDesigner.) |
![]() | GetBounds() | Retrieves the coordinates of the rectangle representing the boundaries for the control as displayed on the design surface.(Inherited from ControlDesigner.) |
![]() | GetDesignTimeHtml() | Retrieves the HTML markup for displaying the associated data source control at design time.(Overrides ControlDesigner.GetDesignTimeHtml().) |
![]() | 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() | 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.) |
![]() | GetErrorDesignTimeHtml(Exception) | Retrieves the HTML markup that provides information about the specified exception. (Inherited from ControlDesigner.) |
![]() | 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() | Obsolete. Retrieves the persistable inner HTML markup of the control.(Inherited from ControlDesigner.) |
![]() | GetService(Type) | Attempts to retrieve the specified type of service from the design mode site of the designer's component.(Inherited from ComponentDesigner.) |
![]() | GetType() | |
![]() | GetView(String) | Retrieves a DesignerDataSourceView object that is identified by the view name. |
![]() | GetViewNames() | Returns an array of the view names that are available in this data source. |
![]() | 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 control designer and loads the specified component.(Inherited from ControlDesigner.) |
![]() | InitializeExistingComponent(IDictionary) | Reinitializes an existing component.(Inherited from ComponentDesigner.) |
![]() | InitializeNewComponent(IDictionary) | Initializes a newly created component.(Inherited from ComponentDesigner.) |
![]() | InitializeNonDefault() | 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.) |
![]() | 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() | |
![]() | OnAutoFormatApplied(DesignerAutoFormat) | Called when a predefined, automatic formatting scheme has been applied to the associated control.(Inherited from ControlDesigner.) |
![]() | OnBehaviorAttached() | Obsolete. Called when a behavior is associated with the element.(Inherited from HtmlControlDesigner.) |
![]() | 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 the associated control changes.(Inherited from ControlDesigner.) |
![]() | 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(EventArgs) | Raises the DataSourceChanged event when the properties of the data source have changed and the SuppressingDataSourceEvents value is false. |
![]() | OnPaint(PaintEventArgs) | Called when the control designer draws the associated control on the design surface, if the CustomPaint value is true.(Inherited from ControlDesigner.) |
![]() | OnSchemaRefreshed(EventArgs) | Raises the SchemaRefreshed event when the schema of the data source has changed and the SuppressingDataSourceEvents value is false. |
![]() | OnSetComponentDefaults() | Obsolete. Sets the default properties for the component.(Inherited from ComponentDesigner.) |
![]() | OnSetParent() | Provides a way to perform additional processing when the associated control is attached to a parent control.(Inherited from HtmlControlDesigner.) |
![]() | 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) | Adds properties to or removes properties from the Properties grid in a design host at design time or provides new design-time properties that might correspond to properties on the associated control.(Inherited from ControlDesigner.) |
![]() | 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.) |
![]() | RefreshSchema(Boolean) | Refreshes the schema from the data source, while optionally suppressing events. |
![]() | RegisterClone(Object, Object) | Registers internal data in a cloned control.(Inherited from ControlDesigner.) |
![]() | ResumeDataSourceEvents() | Restores data source events after the data source events have been suppressed. |
![]() ![]() | SchemasEquivalent(IDataSourceSchema, IDataSourceSchema) | Provides a value that indicates whether two schemas are equal. |
![]() | 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.) |
![]() | SetViewFlags(ViewFlags, Boolean) | Assigns the specified bitwise ViewFlags enumeration to the specified flag value.(Inherited from ControlDesigner.) |
![]() | SuppressDataSourceEvents() | Postpones all data source events until after the ResumeDataSourceEvents method is called. |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
![]() | UpdateDesignTimeHtml() | Refreshes the design-time HTML markup for the associated Web server control by calling the GetDesignTimeHtml method.(Inherited from ControlDesigner.) |
![]() ![]() | ViewSchemasEquivalent(IDataSourceViewSchema, IDataSourceViewSchema) | Provides a value that determines whether two schema views are equal. |
| Name | Description | |
|---|---|---|
![]() | DataSourceChanged | Occurs when any property of the associated data source changes. |
![]() | SchemaRefreshed | Occurs after the schema has been refreshed. |
The DataSourceDesigner class is the base class for data source designers, such as the SqlDataSourceDesigner, AccessDataSourceDesigner, and ObjectDataSourceDesigner classes. If you create a new data source control, you might also want to create a custom control designer for your control and derive it from the DataSourceDesigner class.
The DataSourceDesigner class has two event methods: the OnDataSourceChanged and OnSchemaRefreshed methods. Both of these events can be temporarily disabled with the SuppressDataSourceEvents method, which sets the SuppressingDataSourceEvents property. The event methods can be enabled again with the ResumeDataSourceEvents method.
There are two static methods that you can use to evaluate the equivalency of schemas or views without creating an instance of the class:
The SchemasEquivalent method compares two schemas.
The ViewSchemasEquivalent method compares the schemas of two views.
Notes to Inheritors:
To provide commands for the action list menu at design time in a derived class, you must override the ActionLists property to return a custom DesignerActionListCollection object with custom items that are derived from the DesignerActionList object.
The following code example shows how to use a custom data source control with several other small custom classes, as listed in the following table.
Custom class | Derived from |
|---|---|
CustomDataSource | |
CustomDataSourceDesigner | DataSourceDesigner |
CustomDataSourceView | |
CustomDesignDataSourceView | |
BookListViewSchema | |
CustomIDFieldSchema | |
CustomTitleFieldSchema | |
BookItem (A two-field data structure.) |
After compiling the code example, open the .aspx page in Design view and then set the DataSourceID property to the ID of the custom data source control.
Imports Microsoft.VisualBasic Imports System Imports System.Data Imports System.Security.Permissions Imports System.Collections Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.Design Imports System.Web.UI.Design.WebControls Imports System.ComponentModel Imports System.ComponentModel.Design Namespace ASPNet.Design.Samples_VB <Designer(GetType(CustomDataSourceDesigner)), _ ToolboxData("<{0}:CustomDataSource runat=""server""></{0}:CustomDataSource>")> _ Public Class CustomDataSource Inherits ObjectDataSource Dim _defaultViewName As String = "BookList" Dim _view As ObjectDataSourceView = Nothing Public Sub New() MyBase.New() End Sub ' Gets a view by name Protected Overrides Function GetView(ByVal viewName As String) As DataSourceView ' This data source only allows one view If Not (viewName.Equals(_defaultViewName)) Then Return Nothing ElseIf IsNothing(_view) Then _view = New CustomDataSourceView(Me, _ _defaultViewName, HttpContext.Current) End If Return _view End Function ' Gets a list of view names for this class Protected Overrides Function GetViewNames() As ICollection Dim ar As New ArrayList() ar.Add(_defaultViewName) Return CType(ar, ICollection) End Function End Class ' The runtime data source view Public Class CustomDataSourceView Inherits ObjectDataSourceView Dim _data As ArrayList = Nothing Public Sub New(ByVal owner As CustomDataSource, ByVal viewName As String, ByVal context As HttpContext) MyBase.New(owner, viewName, context) owner.SelectCountMethod = "GetCount" End Sub ' This method would typically get a set of live data ' rather than create some dummy data Protected Overrides Function ExecuteSelect(ByVal arguments As DataSourceSelectArguments) As System.Collections.IEnumerable If (IsNothing(_data)) Then _data = New ArrayList() _data.Add(New BookItem("ID_1", "Runtime Title 01")) _data.Add(New BookItem("ID_2", "Runtime Title 02")) _data.Add(New BookItem("ID_3", "Runtime Title 03")) End If Return CType(_data, IEnumerable) End Function ' Allow getting the record count Public Overrides ReadOnly Property CanRetrieveTotalRowCount() As Boolean Get Return True End Get End Property ' Returns the number of records in the current set of data Public ReadOnly Property GetCount() As Integer Get If IsNothing(_data) Then Return 0 Else Return _data.Count End If End Get End Property ' Do not allow deletions Public Overrides ReadOnly Property CanDelete() As Boolean Get Return False End Get End Property ' Do not allow insertions Public Overrides ReadOnly Property CanInsert() As Boolean Get Return False End Get End Property ' Do not allow paging Public Overrides ReadOnly Property CanPage() As Boolean Get Return False End Get End Property ' Do not allow sorting Public Overrides ReadOnly Property CanSort() As Boolean Get Return False End Get End Property ' Do not allow updating Public Overrides ReadOnly Property CanUpdate() As Boolean Get Return False End Get End Property End Class ' A class to define a record of the data Public Class BookItem Private _id As String Private _title As String Public Sub New(ByVal id As String, ByVal title As String) _id = id _title = title End Sub Public ReadOnly Property ID() As String Get Return _id End Get End Property Public Property Title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property End Class ' Custom designer for the CustomDataSource control. Public Class CustomDataSourceDesigner Inherits DataSourceDesigner Private _control As CustomDataSource = Nothing Private _defaultViewName As String = "BookList" Private _view As CustomDesignDataSourceView = Nothing Public Overrides Sub Initialize(ByVal cmponent As IComponent) MyBase.Initialize(cmponent) _control = CType(cmponent, CustomDataSource) End Sub ' Get a view Public Overrides Function GetView(ByVal viewName As String) As DesignerDataSourceView If Not (viewName.Equals(_defaultViewName)) Then Return Nothing ElseIf IsNothing(_view) Then _view = New CustomDesignDataSourceView(Me, _ _defaultViewName) End If Return _view End Function ' Get a list of view names Public Overrides Function GetViewNames() As String() Return New String() {"BookList"} End Function ' Don't allow refreshing the schema Public Overrides ReadOnly Property CanRefreshSchema() As Boolean Get Return False End Get End Property ' Do not allow resizing Public Overrides ReadOnly Property AllowResize() As Boolean Get Return False End Get End Property End Class ' A design-time data source view Public Class CustomDesignDataSourceView Inherits DesignerDataSourceView Private _data As ArrayList = Nothing Public Sub New(ByVal owner As CustomDataSourceDesigner, ByVal viewName As String) MyBase.New(owner, viewName) End Sub ' Get data for design-time display Public Overrides Function GetDesignTimeData( _ ByVal minimumRows As Integer, _ ByRef isSampleData As Boolean) As IEnumerable If IsNothing(_data) Then ' Create a set of design-time fake data _data = New ArrayList() Dim i As Integer For i = 1 To minimumRows _data.Add(New BookItem("ID_" & i.ToString(), _ "Design-Time Title 0" & i.ToString())) Next End If isSampleData = True Return CType(_data, IEnumerable) End Function Public Overrides ReadOnly Property Schema() As IDataSourceViewSchema Get Return New BookListViewSchema() End Get End Property ' Allow getting the record count Public Overrides ReadOnly Property CanRetrieveTotalRowCount() As Boolean Get Return True End Get End Property ' Do not allow deletions Public Overrides ReadOnly Property CanDelete() As Boolean Get Return False End Get End Property ' Do not allow insertions Public Overrides ReadOnly Property CanInsert() As Boolean Get Return False End Get End Property ' Do not allow updates Public Overrides ReadOnly Property CanUpdate() As Boolean Get Return False End Get End Property ' Do not allow paging Public Overrides ReadOnly Property CanPage() As Boolean Get Return False End Get End Property ' Do not allow sorting Public Overrides ReadOnly Property CanSort() As Boolean Get Return False End Get End Property End Class ' A custom View Schema class Public Class BookListViewSchema Implements IDataSourceViewSchema Public Sub New() End Sub ' The name of this View Schema Public ReadOnly Property Name() As String Implements IDataSourceViewSchema.Name Get Return "BookList" End Get End Property ' Build a Field Schema array Public Function GetFields() As IDataSourceFieldSchema() Implements IDataSourceViewSchema.GetFields Dim fields(1) As IDataSourceFieldSchema fields(0) = New CustomIDFieldSchema() fields(1) = New CustomTitleFieldSchema() Return fields End Function ' There are no child views, so return Nothing Public Function GetChildren() As IDataSourceViewSchema() Implements IDataSourceViewSchema.GetChildren Return Nothing End Function End Class ' A custom Field Schema class for ID Public Class CustomIDFieldSchema Implements IDataSourceFieldSchema Public Sub New() End Sub ' Name is ID Public ReadOnly Property Name() As String Implements IDataSourceFieldSchema.Name Get Return "ID" End Get End Property ' Data type is string Public ReadOnly Property DataType() As Type Implements IDataSourceFieldSchema.DataType Get Return GetType(String) End Get End Property ' This is not an Identity field Public ReadOnly Property Identity() As Boolean Implements IDataSourceFieldSchema.Identity Get Return False End Get End Property ' This field is read only Public ReadOnly Property IsReadOnly() As Boolean Implements IDataSourceFieldSchema.IsReadOnly Get Return True End Get End Property ' This field is unique Public ReadOnly Property IsUnique() As Boolean Implements IDataSourceFieldSchema.IsUnique Get Return True End Get End Property ' This field can't be longer than 20 Public ReadOnly Property Length() As Integer Implements IDataSourceFieldSchema.Length Get Return 20 End Get End Property ' This field can't be null Public ReadOnly Property Nullable() As Boolean Implements IDataSourceFieldSchema.Nullable Get Return False End Get End Property ' This is a Primary Key Public ReadOnly Property PrimaryKey() As Boolean Implements IDataSourceFieldSchema.PrimaryKey Get Return True End Get End Property ' These properties do not apply Public ReadOnly Property Precision() As Integer Implements IDataSourceFieldSchema.Precision Get Return -1 End Get End Property Public ReadOnly Property Scale() As Integer Implements IDataSourceFieldSchema.Scale Get Return -1 End Get End Property End Class ' A custom Field Schema class for Title Public Class CustomTitleFieldSchema Implements IDataSourceFieldSchema Public Sub New() End Sub ' Name is Title Public ReadOnly Property Name() As String Implements IDataSourceFieldSchema.Name Get Return "Title" End Get End Property ' Type is string Public ReadOnly Property DataType() As Type Implements IDataSourceFieldSchema.DataType Get Return GetType(String) End Get End Property ' This is not an Identity field Public ReadOnly Property Identity() As Boolean Implements IDataSourceFieldSchema.Identity Get Return False End Get End Property ' This field is not read only Public ReadOnly Property IsReadOnly() As Boolean Implements IDataSourceFieldSchema.IsReadOnly Get Return False End Get End Property ' This field is not unique Public ReadOnly Property IsUnique() As Boolean Implements IDataSourceFieldSchema.IsUnique Get Return False End Get End Property ' This field can't be longer than 100 Public ReadOnly Property Length() As Integer Implements IDataSourceFieldSchema.Length Get Return 100 End Get End Property ' This field can't be null Public ReadOnly Property Nullable() As Boolean Implements IDataSourceFieldSchema.Nullable Get Return False End Get End Property ' This is not the Primary Key Public ReadOnly Property PrimaryKey() As Boolean Implements IDataSourceFieldSchema.PrimaryKey Get Return False End Get End Property ' These properties do not apply Public ReadOnly Property Precision() As Integer Implements IDataSourceFieldSchema.Precision Get Return -1 End Get End Property Public ReadOnly Property Scale() As Integer Implements IDataSourceFieldSchema.Scale Get Return -1 End Get End Property End Class End Namespace
<%@ Page Language="VB" %> <%@ Register TagPrefix="aspSample" Namespace="ASPNet.Design.Samples_VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <aspSample:CustomDataSource runat="server" ID="CustomDS1"></aspSample:CustomDataSource> <asp:GridView ID="GridView1" runat="server"></asp:GridView> </div> </form> </body> </html>
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)