当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET DesignerDataSourceView类代码示例

本文整理汇总了VB.NET中System.Web.UI.Design.DesignerDataSourceView的典型用法代码示例。如果您正苦于以下问题:VB.NET DesignerDataSourceView类的具体用法?VB.NET DesignerDataSourceView怎么用?VB.NET DesignerDataSourceView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DesignerDataSourceView类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: CustomDesignDataSourceView

' 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
开发者ID:VB.NET开发者,项目名称:System.Web.UI.Design,代码行数:71,代码来源:DesignerDataSourceView

示例2: New

' 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
开发者ID:VB.NET开发者,项目名称:System.Web.UI.Design,代码行数:164,代码来源:DesignerDataSourceView


注:本文中的System.Web.UI.Design.DesignerDataSourceView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。