⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpledatabound.vb

📁 asp.net技术内幕的书配源码
💻 VB
字号:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Collections

Namespace myControls

Public Class SimpleDataBound
Inherits Control

Private _dataSource As IEnumerable

Public Property DataSource As IEnumerable
Get
  Return _dataSource
End Get
Set
  _dataSource = Value
End Set
End Property

Protected Overrides Sub OnDataBinding( e As EventArgs )
  Dim DataEnum As IEnumerator
  Dim ltlLiteral As LiteralControl

  If Not DataSource Is Nothing
    Controls.Clear()
    DataEnum = DataSource.GetEnumerator()
    While ( DataEnum.MoveNext() )
      ltlLiteral = New LiteralControl( DataEnum.Current.ToString() )
      Controls.Add( ltlLiteral )
      Controls.Add( New LiteralControl( "<br>" ) )
    End While
  End If
End Sub

End Class

End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -