所以,我有一个gridview,其中包含用自动完成扩展器包装的文本框。
单击gridview外部的按钮以清除并将焦点设置到gridview中的特定文本框。
输入文本框并输入数据时,自动完成选项不会弹出。 (自动完成功能在下面的按钮点击事件之前有效)
下面是按钮单击事件上的代码
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);
}