TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kalu singh rao
288
6.4k
109.3k
cannot call methods on autocomplete prior to initialization
Jan 7 2015 7:26 AM
I am working on autocomplete functionality with textbox using HttpHandler. But i have got error like as cannot call methods on autocomplete prior to initialization; attempted to call method 'AutoCompleteHandler.ashx'. I am using following code.
JQuery Libraries-
<script type="text/javascript" language="javascript" src="../JS/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="../JS/jquery-ui-1.9.2.js"></script>
JSCode-
$(document).ready(function () {
$('#<%=txtSearch.ClientID%>').autocomplete('AutoCompleteHandler.ashx');
});
AutoCompleteHandler.ashx code is following-
<%@ WebHandler Language="VB" Class="AutoCompleteHandler" %>
Imports System
Imports System.Web
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Text
Public Class AutoCompleteHandler : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'context.Response.ContentType = "text/plain"
'context.Response.Write("Hello World")
Dim SHGName As String = context.Request.QueryString("q")
Dim conn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("YesBankStr").ConnectionString)
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "Select cSHGName from SHG where cSHGName like ''+@SearchSHGName+'%'"
cmd.Parameters.AddWithValue("@SearchSHGName", SHGName)
cmd.Connection = conn
Dim sb As StringBuilder = New StringBuilder
conn.Open()
Dim sdr As SqlDataReader = cmd.ExecuteReader
While sdr.Read
sb.Append(sdr("cSHGName")) _
.Append(Environment.NewLine)
End While
conn.Close()
context.Response.Write(sb.ToString)
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
Reply
Answers (
2
)
Exporting table to pdf
Dynamically create control and set id for control in asp.net