I have a problem. It has to do with the AutoComplete control. Well first things first, i write in VB.net and suspect the problem may arrise from compatability with that.
The thing is i can run sample applications with the toolkit, works fine. But when i want to put it to use, namely change code from C# to VB the film snaps, so to speak.
Well some of the controls work, some don't or cause direct script errors. The control i am interested in (was actually going to build it when i saw the new release) is the AutoComplete control.
I have been doing some with custom, user and rendered controls with .net in the past and am positively thrilled about the outlook, but it's gotta work. So here follow the details, i really hope i am doing something wrong, that it can work:
Step one was to convert the web service associate with the example which was done by creating a new AJAX enabled website, then adding reference to the AjaxControlToolkit
The service in VB.net looks like this (and works if navigating to it by the .asmx extention):
'----File listing AutoComplete.vb :
Imports
System.Web
Imports
System.Web.Services
Imports
System.Web.Services.Protocols
<WebService(Namespace:=
"http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<
Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public
Class AutoComplete
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
Dim Rnd As Random, items() As String, i As Integer, strTemp As String = ""
If count = 0 Then count = 10
If prefixText.Equals("xyz") Then
Return New ArrayList(0).ToArray
End If
Rnd =
New Random
ReDim items(count)
For i = 0 To count Step 1
Dim c1 As Char = Chr(Rnd.Next(65, 90))
Dim c2 As Char = Chr(Rnd.Next(97, 122))
Dim c3 As Char = Chr(Rnd.Next(97, 122))
strTemp = prefixText & c1 & c2 & c3
items(i) = strTemp
Next
Return items
End Function
End
Class
'---- END of File listing AutoComplete.asmx.vb :
So far so good. I was using a single page web application to test this, so i cleverly named the form just like in the sample, but omitted to use the master/ detail page structure.
The page looks like this (and produces no result, no nice drop down div to be navigated into with arrow keys or anything, nothing happens when i run this:)
'-------------File listing Default.aspx------------------
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="AJAX" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<title>Untitled Page</title>
</
head>
<
body>
<form id="aspnetForm" name="aspnetForm" runat="server">
<asp:ScriptManager runat="server" />
<div class="demoarea">
<div class="demoheading">AutoComplete Control lab</div>
<p/>
Type something
:
<asp:TextBox runat="server" ID="myTextBox" Width="300" autocomplete="off" />
<AJAX:AutoCompleteExtender
runat="server"
ID="autoComplete1"
TargetControlID="myTextBox"
ServicePath="AutoComplete.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />
<script type="text/javascript">
// Work around browser behavior of "auto-submitting" simple forms
var frm = document.getElementById("aspnetForm");
if (frm) {
frm.onsubmit =
function() { return false; };
}
</script>
</div>
</form>
</
body>
</
html>
'-------------End of File listing Default.aspx------------------
As you may notice it is a complete copy of the AjaxControlToolkit example, with the only difference that i have allowed myself to register the toolkit using the AJAX prefix instead of the longer ajaxToolkit tagprefix.
Can you assist in this? I will be bouncing about in the lab cheering with spontaneus 'the wave's and crowd sounds in your general direction if you can
Secondly, have you had a working version of the AutoComplete control running? ( that i might know the source of the error is touching my keys )