Wednesday, March 28, 2012

Dynamic AutoCompleteExtenders -- 0 Requests Made

I'm dynamically creating a set of textboxes with autocompleteextenders, but something's not going quite right. Here's the code:

FilterList.Controls.Clear(); Table FiltersTable =new Table(); FilterList.Controls.Add(FiltersTable);foreach (string Filterin _Columns) { TableRow FilterRow =new TableRow(); TableCell LabelCell =new TableCell(); Label ColumnName =new Label(); ColumnName.Text = Filter +":"; LabelCell.Controls.Add(ColumnName); TableCell TextCell =new TableCell(); TextBox ColumnText =new TextBox(); ColumnText.ID = Filter +"Box"; ColumnText.Width = 100; ColumnText.CssClass = Filter; TextCell.Controls.Add(ColumnText); AjaxControlToolkit.AutoCompleteExtender Extender =new AjaxControlToolkit.AutoCompleteExtender(); Extender.ID = Filter +"Extender"; Extender.TargetControlID = ColumnText.ID; Extender.ServicePath ="GetAutoCompleteItems.asmx"; Extender.ServiceMethod ="GetCompletionList"; Extender.MinimumPrefixLength = 2; Extender.CompletionInterval = 500; Extender.CompletionSetCount = 10; Extender.ContextKey = Filter; TextCell.Controls.Add(Extender); FilterRow.Cells.Add(LabelCell); FilterRow.Cells.Add(TextCell); FiltersTable.Rows.Add(FilterRow); }

I brought up Firefox/Firebug and watched the network requests. I'd clear out the list of current requests so it was completely empty. As soon as I typed 2 characters into one of the textboxes, firebug would pop up "0 requests". And of course my web service is never hit.

Any ideas on what I might be doing wrong?

I'm still trying to figure this out. Has anyone had any success dynamically adding AutoCompleteExtenders to a page?

Edit: After more searching, it appears the answer fromthis page works.

No comments:

Post a Comment