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
dhoni kholi
NA
198
42.6k
Autocomplete textbox not working Asp.net
Dec 18 2019 6:01 AM
My Code
This Part Working Properly
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.Services;
using
System.Data.SqlClient;
using
System.Configuration;
using
System.Web.Script.Services;
namespace
Product
{
/// <summary>
/// Summary description for CustService
/// </summary>
[WebService(Namespace =
"http://tempuri.org/"
)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(
false
)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public
class
CustService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public
List<
string
> GetAutoCompleteData(
string
name)
{
List<
string
> result =
new
List<
string
>();
using
(SqlConnection con =
new
SqlConnection(@
"Data Source=KARUKUVELRAJ-PC\SQLEXPRESS;Initial Catalog=Product;Integrated Security=True"
))
{
using
(SqlCommand cmd =
new
SqlCommand(
"select DISTINCT name from customer where name LIKE '%'+@SearchText+'%'"
, con))
{
con.Open();
cmd.Parameters.AddWithValue(
"@SearchText"
, name);
SqlDataReader dr = cmd.ExecuteReader();
while
(dr.Read())
{
result.Add(dr[
"name"
].ToString());
}
return
result;
}
}
}
}
}
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
</asp:ScriptManager>
<asp:TextBox ID="txtName" runat="server" Font-Bold="False" CssClass="form-control"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" ServiceMethod="GetAutoCompleteData" CompletionInterval="10" EnableCaching="False" TargetControlID="txtName" ServicePath="~/CustService.asmx"> </ajaxToolkit:AutoCompleteExtender>
I Run This Code Not invoke it not Response, How to Clear this Problem
Reply
Answers (
4
)
Call JavaScript function on <a> for show hide textbox
Autocomplete textbox not working Asp.net