JQuery Auto complete and ASP.net
I am new here in the forum and also new to the JQuery. I was finding how to use JQuery Auto complete in my asp.net on Internet , I come through following article
which shows how to use JQuery Auto complete with asp.net. I download its source code and I ran it successfully, his codes working good.
But when I integrate it in my project. It is not working. I found that his project is made on asp.net 3.5 and my project is made on asp.net 2.0
This is my code which I am using
ASPX page code
- <script language="javascript" type="text/javascript">
- $(document).ready(function() {
- //Code to fetch
- $.ajax({
- type: "POST",
- url: "../AutoComplete.asmx/GetCompleteActorList",
- dataType: "json",
- data: "{}",
- contentType: "application/json; charset=utf-8",
- success: function(data) {
- var datafromServer = data.d.split(":");
- $("[id$='actorList']").autocomplete({
- source: datafromServer
- });
- },
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- alert(textStatus);
- }
- });
- });
- </script>
In the form part of aspx page
- <asp:TextBox ID="actorList" runat="server" CssClass="input"/>
This is my Webservice
- <WebMethod()> _
- Public Function GetCompletionActorList() As String
- Dim sbActor As New StringBuilder()
- Dim actorAPI As New ActorBLL
- Dim actor As Q8movies.ActorDetailDataTable = actorAPI.GetActorDetail()
- Try
- For i As Integer = 0 To actor.Rows.Count - 1
- sbActor.AppendFormat("{0}:", actor.Rows(i).Item("ActorName"))
- Next
- 'Removes the extra ":"
- sbActor = sbActor.Remove(sbActor.Length - 1, 1)
- Catch ex As Exception
- 'Setup a breakpoint here
- 'to verify any exceptions raised.
- Dim exp As String = ex.ToString()
- End Try
- Return sbActor.ToString()
- End Function
So can somebody help me to know where I am doing mistake. Or is it like asp.net 3.5 can be only use for this. But I feel that is not the case. Kindly help me out to solve this problem.