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

📄 defaultvb.aspx.vb

📁 Telerik是很大的第三方软件制造商
💻 VB
字号:

Imports System
Imports System.Collections
Imports System.Data
Imports System.IO
Imports Telerik.QuickStart
Imports Telerik.WebControls


Namespace Telerik.ComboboxExamplesVB.DataBinding
   
   '/ <summary>
   '/ Summary description for _Default.
   '/ </summary>
   Public Class DefaultVB
      Inherits XhtmlPage
      Protected RadComboBox1 As Telerik.WebControls.RadComboBox
      Protected RadComboBox2 As Telerik.WebControls.RadComboBox
      Protected RadComboBox3 As Telerik.WebControls.RadComboBox
      Protected RadComboBox4 As Telerik.WebControls.RadComboBox
      
      
      Private Sub BindToArrayList(combo As RadComboBox)
         Dim itemsList As New ArrayList()
         itemsList.Add("One")
         itemsList.Add("Two")
         itemsList.Add("Three")
         
         combo.DataSource = itemsList
         combo.DataBind()
      End Sub 'BindToArrayList
      
      
      Private Sub BindToArray(combo As RadComboBox)
         Dim itemsList As String() =  {"One", "Two", "Three"}
         
         combo.DataSource = itemsList
         combo.DataBind()
      End Sub 'BindToArray
      
      
      Private Sub BindToDataTable(combo As RadComboBox)
         Dim itemsList As String() =  {"One", "Two", "Three"}
         
         Dim table As New DataTable()
         
         table.Columns.Add("One")
         table.Columns.Add("Two")
         table.Columns.Add("Three")
         
         table.Rows.Add(New String() {"One", "One", "One"})
         table.Rows.Add(New String() {"Two", "Two", "Two"})
         table.Rows.Add(New String() {"Three", "Three", "Three"})
         
         combo.DataTextField = "One"
         combo.DataValueField = "Two"
         combo.DataSource = table
         combo.DataBind()
      End Sub 'BindToDataTable
      
      
      Private Sub BindToDataSet(combo As RadComboBox)
         Dim dataSet As New DataSet()
         Dim table As New DataTable("Items")
         dataSet.Tables.Add(table)
         
         table.Columns.Add("One")
         table.Columns.Add("Two")
         table.Columns.Add("Three")
         
         table.Rows.Add(New String() {"One", "One", "One"})
         table.Rows.Add(New String() {"Two", "Two", "Two"})
         table.Rows.Add(New String() {"Three", "Three", "Three"})
         
         combo.DataTextField = "One"
         combo.DataValueField = "One"
         combo.DataMember = "Items"
         combo.DataSource = dataSet
         combo.DataBind()
      End Sub 'BindToDataSet
      
      
      Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
         If Not Page.IsPostBack Then
            BindToArray(RadComboBox1)
            BindToArrayList(RadComboBox2)
            BindToDataTable(RadComboBox3)
            BindToDataSet(RadComboBox4)
         End If
      End Sub 'Page_Load
      Protected Overrides Sub OnInit(e As EventArgs)
         '
         ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
         '
         InitializeComponent()
         MyBase.OnInit(e)
      End Sub 'OnInit
      
      
      '/		Required method for Designer support - do not modify
      '/		the contents of this method with the code editor.
      '/ </summary>
      Private Sub InitializeComponent()
      End Sub 'InitializeComponent
   End Class 'DefaultVB 
End Namespace 'Telerik.ComboboxExamplesVB.DataBinding

⌨️ 快捷键说明

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