十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
DE:Visual Web Developer 2008 Express Edition
成都创新互联是一家朝气蓬勃的网站建设公司。公司专注于为企业提供信息化建设解决方案。从事网站开发,网站制作,网站设计,网站模板,微信公众号开发,软件开发,微信平台小程序开发,十年建站对成都咖啡厅设计等多个领域,拥有多年建站经验。DB:Access 2007
到http://www.asp.net/ajax/downloads/下载AJAX Control Toolkit,将AjaxControlToolkit.dll拷贝到项目的bin目录下,在工具栏中引入。
在Web.config的
[xhtml] view plain copy
< add tagPrefix = "ajaxToolkit" namespace = "AjaxControlToolkit" assembly = "AjaxControlToolkit" />
WebService的代码:(aaa.asmx)
[vb] view plain copy
Public Function GetCompletionList( ByVal prefixText As String , ByVal count As Integer ) As String ()
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim dbname As String
dbname = Server.MapPath( "location.accdb" )
myConnection = New OleDbConnection( "Provider=Microsoft.ACE.OLEDB.12.0;DATA Source=" & dbname)
myConnection.Open()
Dim list As New List(Of String )
myCommand = New OleDbCommand( "SELECT DISTINCT(columnName) FROM tableName WHERE columnName LIKE '" + prefixText & "%" + "'" , myConnection)
Dim reader As OleDbDataReader = myCommand.ExecuteReader()
Do While reader.Read
list.Add(reader.GetString(0))
Loop
Return list.ToArray()
End Function
FORM中的代码:(aaa.aspx)
[xhtml] view plain copy
< asp:TextBox ID = "txtNo" runat = "server" autopostback = "true" Columns = "50" > asp:TextBox >
< ajaxToolkit:AutoCompleteExtender ID = "txtNo_AutoCompleteExtender" runat = "server" Enabled = "True" ServiceMethod = "GetCompletionList" ServicePath = "aaa.asmx" TargetControlID = "txtNo" MinimumPrefixLength = "1" EnableCaching = "true" >
ajaxToolkit:AutoCompleteExtender >
以上即可。
AJAX日期控件的使用也很方便,如:
[xhtml] view plain copy
< asp:TextBox ID = "txtDate" runat = "server" Columns = "24" > asp:TextBox >
< ajaxToolkit:CalendarExtender ID = "txtDate_CalendarExtender" runat = "server" Enabled = "True" TargetControlID = "txtDate" >
ajaxToolkit:CalendarExtender >
如果您觉得此篇文章对您有帮助,欢迎关注微信公众号:大禹编程,您的支持是对我大的鼓励!共同学习,共同进步:)