locked
AutocompleteExtender not working in master page RRS feed

  • Question

  • User-400463726 posted

    Hi !!!

    I have a problem regarding the autocomplete extender in ASP.NET - it works fine in all pages I have, but NOT in a master page and i don't know why.

    In other words, when the web page is integrated into a master page, the autocomplete control does not work anymore.

    Thanks

    Thursday, December 13, 2018 10:34 PM

All replies

  • User-1174608757 posted

    Hi Raul Soni

      According to your description,I have made a sample here.I create a Webservice file to save the ServiceMethod of AutoCompleteExtender.I find it works well in a web page which is integrated into a master page.If you still have problems,could you please post the detail codes about how you use the autocompleteextender in the master page and child page?

    More details about my test demo, you could refer to below codes:

    aspx integrated into a master page:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="autoextend.aspx.cs" Inherits="Dact._12._17.autoextend" %>
    
     
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    
                <ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1" ServicePath="WebService1.asmx" ServiceMethod="GetData" MinimumPrefixLength="1"  ></ajaxToolkit:AutoCompleteExtender>
    
       
    
    </asp:Content>

    WebService1.asmx:

    [WebService(Namespace = "http://tempuri.org/")]
    
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    
        [System.ComponentModel.ToolboxItem(false)]
    
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    
         [System.Web.Script.Services.ScriptService]
    
        public class WebService1 : System.Web.Services.WebService
    
        {
    
     
    
            [WebMethod]
    
            public string[] GetData(string prefixText, int count)
    
            {
    
                string[] data = new string[10000];
    
                for (int i = 0; i < data.Length; i++)
    
                    data[i] = i.ToString("0000");
    
                return data.Where(p => p.IndexOf(prefixText) >= 0).Take(count).ToArray();
    
            }
    
        }

    Monday, December 17, 2018 6:09 AM
  • User-552477072 posted

    Hi Raul Soni,

    Have you added EnablePageMethods="true" property to your script manager? If not add.

    Tuesday, December 18, 2018 6:32 AM