Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

AutoCompleteExtender nested in GridView not working in Chrome

$
0
0

Hello,

I have an AutoCompleteExtender connected to an editable textbox, nested inside a GridView. In Firefox and IE, the code works as it should: the user types a few characters, and a list of suggestions appears. However, this does not happen in Chrome 27.

I created the AutoCompleteExtender following the directions given here: http://www.asp.net/ajaxlibrary/act_AutoComplete_Simple.ashx, and if I use the extender by itself (outside of a GridView) in Chrome, it works fine. Unfortunately, I need it to work within a GridView for this project, so if anyone has a solution, it would be much appreciated. My code is below. FYI, I am coding in C#, using Ajax Control Toolkit 4.1.7.429, in Visual Studio 2010 (if that last matters at all.)

In my markup:

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager><asp:GridView ...><asp:TemplateField ...><ItemTemplate><asp:TextBox ID="dogHandlerEdit" runat="server"></asp:TextBox><ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="dogHandlerEdit" ServiceMethod="GetCompletionList" UseContextKey="True"
CompletionListCssClass="handlerAutoComplete"></ajaxToolkit:AutoCompleteExtender></ItemTemplate></asp:TemplateField></asp:GridView>

And then in my code-behind:

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        List<string> lstList = new List<string>();

        // Create data context
        DataContext dc = new DataContext( ... );

        // Get dog info
        var people = (from p in dc.PPL_Peoples
                      //where (p.PPL_FirstName.Contains(prefixText) == true || p.PPL_LastName.Contains(prefixText) == true) && p.PPL_Active == true
                      where (p.PPL_FirstName.StartsWith(prefixText) == true || p.PPL_LastName.StartsWith(prefixText) == true) && p.PPL_Active == true
                      orderby p.PPL_LastName ascending, p.PPL_FirstName ascending
                      select new
                      {
                          p.PPL_FirstName,
                          p.PPL_LastName

                      }).Take(30);

        // Add names to the list
        foreach (var person in people)
        {
            lstList.Add(person.PPL_FirstName + " " + person.PPL_LastName);
        }

        return lstList.ToArray();
    }

Thanks in advance for your help.



Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>