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

📄 defaultvb.aspx.vb

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

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI
Imports System.IO
Imports System.Web.UI.WebControls
Imports Telerik.QuickStart
Imports Telerik.WebControls


Namespace Telerik.ComboboxExamplesVB.MultiColumnCombo
   
   '/ <summary>
   '/ Summary description for _Default.
   '/ </summary>
   Public Class DefaultVB
      Inherits XhtmlPage
      Protected WithEvents Button1 As System.Web.UI.WebControls.Button
      Protected Label1 As System.Web.UI.WebControls.Label
      Protected Lable1 As System.Web.UI.WebControls.Label
      Protected WithEvents RadComboBox1 As Telerik.WebControls.RadComboBox
      
      
      Private Sub LoadSupervisors(filter As String)
         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"
         If filter <> [String].Empty Then
            sql += " WHERE CompanyName LIKE '" + filter.Replace("'", "''") + "%'"
         End If
         
         Dim adapter As New OleDbDataAdapter(sql, dbCon)
         Dim dt As New DataTable()
         adapter.Fill(dt)
         dbCon.Close()
         
         RadComboBox1.DataSource = dt
         RadComboBox1.DataBind()
      End Sub 'LoadSupervisors
      
      
      Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
         If Not Page.IsPostBack Then
            LoadSupervisors([String].Empty)
         End If
      End Sub 'Page_Load
      
      
      ' Fixing the calendar control XHTML output.
      Protected Overrides Sub Render(writer As HtmlTextWriter)
         Dim stringWriter As New StringWriter()
         Dim newWriter As New HtmlTextWriter(stringWriter)
         MyBase.Render(newWriter)
         Dim pageHtml As String = stringWriter.ToString()
         pageHtml = pageHtml.Replace("<td align=""Center""", "<td align=""center""")
         pageHtml = pageHtml.Replace("<td align=""Right""", "<td align=""right""")
         pageHtml = pageHtml.Replace("<td align=""Left""", "<td align=""left""")
         writer.Write(pageHtml)
      End Sub 'Render
      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 RadComboBox1_ItemsRequested(o As Object, e As Telerik.WebControls.RadComboBoxItemsRequestedEventArgs) Handles RadComboBox1.ItemsRequested
         LoadSupervisors(e.Text)
      End Sub 'RadComboBox1_ItemsRequested
      
      
      Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
         Label1.Text = "You selected: <b>" + RadComboBox1.Text + "</b>"
      End Sub 'Button1_Click
      
      
      Private Sub RadComboBox1_ItemDataBound(o As Object, e As Telerik.WebControls.RadComboBoxItemDataBoundEventArgs) Handles RadComboBox1.ItemDataBound
         e.Item.Text = CType(e.Item.DataItem, DataRowView)("CompanyName").ToString()
      End Sub 'RadComboBox1_ItemDataBound
   End Class 'DefaultVB 
End Namespace 'Telerik.ComboboxExamplesVB.MultiColumnCombo

⌨️ 快捷键说明

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