📄 defaultvb.aspx.vb
字号:
Imports System
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.OleDb
Imports Telerik.QuickStart
Imports Telerik.WebControls
Namespace Telerik.ComboboxExamplesVB.AutoCompleteClientSide
'/ <summary>
'/ Summary description for _Default.
'/ </summary>
Public Class DefaultVB
Inherits XhtmlPage
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents CheckBox1 As System.Web.UI.WebControls.CheckBox
Protected Label1 As System.Web.UI.WebControls.Label
Protected RadComboBox1 As RadComboBox
Private Sub PopulateCombo()
Dim mdbPath As String = Server.MapPath("~/Combobox/Data/NWind.mdb")
Dim dbCon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbPath)
dbCon.Open()
Dim sql As String = "SELECT * FROM Customers ORDER BY ContactName"
Dim adapter As New OleDbDataAdapter(sql, dbCon)
Dim dt As New DataTable()
adapter.Fill(dt)
dbCon.Close()
Dim row As DataRow
For Each row In dt.Rows
Dim names As String() = row("ContactName").ToString().ToLower().Split(" "c)
Dim email As String = names(0) + "@telerik.com"
Dim item As New RadComboBoxItem(email)
RadComboBox1.Items.Add(item)
Next row
End Sub 'PopulateCombo
Private Sub Page_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
PopulateCombo()
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
Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Label1.Text = "You have selected the following email: " + RadComboBox1.Text
End Sub 'Button1_Click
Private Sub CheckBox1_CheckedChanged(sender As Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged
RadComboBox1.AllowCustomText = CheckBox1.Checked
End Sub 'CheckBox1_CheckedChanged
End Class 'DefaultVB
End Namespace 'Telerik.ComboboxExamplesVB.AutoCompleteClientSide
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -