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
43.3k
Autocomplete textbox Nothing Happen
Feb 8 2020 2:39 AM
Hi everyone,
This my Code when i run it Nothing Happen
<
%@ Register
Assembly
=
"AjaxControlToolkit"
Namespace
=
"AjaxControlToolkit"
TagPrefix
=
"ajaxToolkit"
%
>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
div
id
=
"page-wrapper"
>
<
div
class
=
"col-md-12"
>
<!-- Form Elements -->
<
div
class
=
"panel panel-info"
>
<
div
class
=
"panel-heading"
>
<
h3
style
=
"text-shadow: 2px 2px #79aed8;"
>
PRODUCT ENTRY
</
h3
>
</
div
>
<
div
class
=
"panel-body"
>
<
table
>
<
tr
>
<
td
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
EnablePageMethods
=
"True"
>
</
asp:ScriptManager
>
<
asp:Label
ID
=
"lblEmployee"
Text
=
"Employee Search"
runat
=
"server"
>
</
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtPcode"
runat
=
"server"
Width
=
"200"
placeholder
=
"Employee Name"
>
</
asp:TextBox
>
<
ajaxToolkit:AutoCompleteExtender
ID
=
"AutoCompleteExtender1"
runat
=
"server"
TargetControlID
=
"txtPcode"
ServiceMethod
=
"getname"
EnableCaching
=
"True"
MinimumPrefixLength
=
"1"
CompletionInterval
=
"10"
CompletionSetCount
=
"1"
>
</
ajaxToolkit:AutoCompleteExtender
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
</
div
>
</
div
>
</
asp:Content
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Configuration;
using
System.Data.SqlClient;
using
System.Web.Script.Services;
using
System.Web.Services;
namespace
Product
{
public
partial
class
WebForm1 : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
[ScriptMethod()]
[WebMethod]
public
static
List<
string
> getname(
string
name)
{
SqlConnection con;
SqlCommand cmd;
con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"dbcon1"
].ConnectionString);
cmd =
new
SqlCommand();
cmd.Connection = con;
con.Open();
string
query =
"select * from Product where subhead like '%'+ @searchname +'%'"
;
cmd =
new
SqlCommand(query, con);
cmd.Parameters.AddWithValue(
"@searchname"
, name);
SqlDataAdapter sda =
new
SqlDataAdapter(cmd);
DataTable dt =
new
DataTable();
sda.Fill(dt);
List<
string
> names =
new
List<
string
>();
for
(
int
i = 0; i < dt.Rows.Count; i++)
{
names.Add(dt.Rows[i][i].ToString());
}
return
names;
}
}
}
Please help me to how to implement auto complete textbox
Thanks ....
Reply
Answers (
2
)
RoutConfigure more than two routes or one is enough?
List with Parameter’s object name gets Prefixed with @