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
harry code
NA
124
23k
Autocompleteextender not working
Dec 9 2018 11:40 PM
Hi,
I am working with Ajax Autocompleteextender.
It is not displaying the names .
Below is the sample code.
.cs
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public
static
List<
string
> Getfirstname(
string
prefixText)
{
string
strFilter =
string
.Empty;
DataSet ds =
new
DataSet();
System.Data.DataTable dt =
new
System.Data.DataTable();
es_CustomersDAL ObjCustomersDAL =
new
es_CustomersDAL();
ds = ObjCustomersDAL.GetCustomers();
//ds = (DataSet)HttpContext.Current.Session["dsgroups"];
System.Data.DataView dv = ds.Tables[0].DefaultView;
strFilter +=
"ES_CustomerName LIKE '"
+ prefixText +
"%'"
;
dv.RowFilter = strFilter;
dt = dv.ToTable();
List<
string
> GetCustomerName =
new
List<
string
>();
for
(
int
i = 0; i < dv.Count; i++)
{
GetCustomerName.Add(dt.Rows[i][
"ES_CustomerName"
].ToString());
}
return
GetCustomerName;
}
.aspx
<tr>
<td>
</td>
<td width=
"17%"
>
First / Company Name
</td>
<td width=
"32%"
>
<%--<asp:UpdatePanel ID=
"_udpCompanyName"
runat=
"server"
>
<ContentTemplate>--%>
<asp:TextBox TabIndex=
"6"
ID=
"txtfirstname"
placeholder=
"Full Name of Comapany"
runat=
"server"
class
=
"input ui-tooltip"
MaxLength=
"110"
title=
"Please enter slowely name."
></asp:TextBox>
<asp:AutoCompleteExtender ID=
"auto1"
runat=
"server"
TargetControlID=
"txtfirstname"
MinimumPrefixLength=
"1"
EnableCaching=
"false"
CompletionSetCount=
"1"
CompletionInterval=
"100"
ServiceMethod=
"Getfirstname"
></asp:AutoCompleteExtender>
<%-- <asp:AutoCompleteExtender ID=
"AutoComptxtfirstname"
runat=
"server"
TargetControlID=
"txtfirstname"
MinimumPrefixLength=
"1"
EnableCaching=
"true"
CompletionSetCount=
"1"
CompletionInterval=
"100"
ServiceMethod=
"Getfirstname"
>
</asp:AutoCompleteExtender>--%>
<span
class
=
"mandatoryfield"
>* </span><%--</ContentTemplate>
</asp:UpdatePanel>
--%>
</td>
<td width=
"13%"
>
Last Name
</td>
<td width=
"38%"
>
<asp:TextBox TabIndex=
"7"
ID=
"txtlastname"
runat=
"server"
class
=
"input"
MaxLength=
"110"
></asp:TextBox>
</td>
</tr>
Reply
Answers (
9
)
How to write ajax
Record is added in to the database but alert message is not