You must Sign In to post a response.
  • Category: ASP.NET

    Why not AutoCompleteExtender working in bootstrap into

    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="" />
    <link rel="stylesheet" href="" />
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <asp:Content ID="Content2" ContentPlaceHolderID="mBody" runat="Server">
    <asp:UpdatePanel ID="upFarmer" runat="server">
    <asp:PostBackTrigger ControlID="tbFarmerName" />
    <div class="col-sm-4 form-group">
    <b>Farmer Name</b>
    <asp:TextBox ID="tbFarmerName" runat="server" AutoPostBack="true" class="form-control">
    <asp:AutoCompleteExtender ID="aceFarmerName" runat="server" TargetControlID="tbFarmerName"
    MinimumPrefixLength="1" EnableCaching="true" Enabled="true" CompletionSetCount="1"
    CompletionInterval="100" ServiceMethod="GetFarmerName">

    Code in c#
    public static List<string> GetFarmerName(string preFixText)
    DataTable source;
    FarmerEntity farmerEntity;
    FarmerLogic farmerLogic;
    int incVal;

    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++)

    return farmerName;
    catch (Exception ex)
    throw ex;
    source = null;
    farmerEntity = null;
    farmerLogic = null;
  • #767198
    First have you tried debugging that webmethod? is there any exception you are getting? is it returning exact farmerName list from code behind?
    Second thing remove AutoPostBack="true" from your TextBox 'tbFarmerName' and remove PostBackTrigger for 'tbFarmerName' too and check once.

  • #767238

    Have you got any error while calling web method? Please elaborate your requirement with details rather than post your full code, just put a break point and check whether webmethod has been triggered while entering text into textbox control also remove AutoPostBack property for textbox control it is not required in your case.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767242
    Can you provide the error details? If you are getting any exception., give us the details of the error. If you are not getting any exception but not getting data fallowing are some of the tips.

    Check the values is population property? In you code you are trying to get the newly created instance. Are you how you are getting the data. Can you post that part of code?

    farmerLogic = new FarmerLogic();
    source = farmerLogic.SelectFarmerName(farmerEntity);

    By Nathan
    Direction is important than speed

  • Sign In to post your comments