Why not AutoCompleteExtender working in bootstrap into asp.net

Posted by Cpatil1000 under ASP.NET on 7/18/2016 | Points: 10 | Views : 769 | Status : [Member] | Replies : 3
Hi,
I am using ajax AutoCompleteExtender for fill farmer name. but is not working.

<%@ Page Title="" Language="C#" MasterPageFile="~/OTSMaster.master" AutoEventWireup="true"
CodeFile="MyTest.aspx.cs" Inherits="MyTest" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cHead" runat="Server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Page-Enter" content="Alpha(opacity=1.05)" />
<meta http-equiv="Page-Exit" content="Alpha(opacity=1.05)" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mBody" runat="Server">
<asp:UpdatePanel ID="upFarmer" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="tbFarmerName" />
</Triggers>
<ContentTemplate>
<div class="col-sm-4 form-group">
<b>Farmer Name</b>
<asp:TextBox ID="tbFarmerName" runat="server" AutoPostBack="true" class="form-control">
</asp:TextBox>
<asp:AutoCompleteExtender ID="aceFarmerName" runat="server" TargetControlID="tbFarmerName"
MinimumPrefixLength="1" EnableCaching="true" Enabled="true" CompletionSetCount="1"
CompletionInterval="100" ServiceMethod="GetFarmerName">
</asp:AutoCompleteExtender>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>


Code in c#
----------
[System.Web.Script.Services.ScriptMethod()]
[WebMethod]
public static List<string> GetFarmerName(string preFixText)
{
DataTable source;
FarmerEntity farmerEntity;
FarmerLogic farmerLogic;
int incVal;

try
{
farmerEntity = new FarmerEntity();

farmerEntity.Name = preFixText;

farmerLogic = new FarmerLogic();

source = farmerLogic.SelectFarmerName(farmerEntity);

List<string> farmerName = new List<string>();

for (incVal = 0; incVal < source.Rows.Count; incVal++)
{
farmerName.Add(source.Rows[incVal]["NAME"].ToString());
}

return farmerName;
}
catch (Exception ex)
{
throw ex;
}
finally
{
source = null;
farmerEntity = null;
farmerLogic = null;
}
}





Responses

Posted by: Sheonarayan on: 7/19/2016 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Difficult to guess, have you tried to debug the issue in the browser by pressing F12 key? What error you get in the console window? Looks like some dependency files are missing.

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Cpatil1000, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 7/19/2016 [Member] [MVP] Silver | Points: 25

Up
0
Down
Additionally you may also check your search logic. usually the search condition should have a wild card search like '%Te%' so that even with starting letters you will get the results.

Thanks,
A2H
My Blog

Cpatil1000, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhuvanesh6 on: 7/19/2016 [Member] Starter | Points: 25

Up
0
Down
Please try this and let me know,

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetFarmerName(string prefixText)



Bhuvan

Cpatil1000, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response