Autocomplete extender stops working when setting focus to grid view text box

173 Views Asked by At

So, I have a gridview containing textboxes wrapped in autocomplete extenders.

A button outside of the gridview is clicked to clear and set focus to a specific textbox in the gridview.

When the textbox is entered and I key in data the autocomplete options don't pop up. (The auto-complete does work prior to the button click event below)

Below is the code on the button click event

GridViewRow r = gvdView.Rows[0];
TextBox txtbox = (TextBox)r.FindControl("txtG");

if (txtbox != null)
{
    txtbox.Text = string.Empty;
    txtbox.Focus();

    //I added this in, but it doesn't seem to work
    AjaxControlToolkit.AutoCompleteExtender kit = new AjaxControlToolkit.AutoCompleteExtender();
    kit.ID = "AutoCompleteExtenderZ";
    kit.TargetControlID = txtbox.UniqueID;
    kit.Enabled = true;
    kit.CompletionListCssClass = "autoExtender";
    kit.CompletionInterval = 10;
    kit.MinimumPrefixLength = 1;
    kit.ServiceMethod = "GetSearchedList";
    Form.Controls.Add(kit);
}
0

There are 0 best solutions below