Why not AutoCompleteExtender working in bootstrap into asp.net
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;
}
}