AJAX AutoCompleteExtender控件问题?
在TEXTBOX第一次输入字符时,就会闪一下,焦点就会跳到别的地方去```重新把焦点跳回TEXTBOX就没有事了`这问题应该怎样解决??谢谢!<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" EnableViewState="False"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1" CompletionSetCount="10" CompletionInterval="1000"
EnableCaching="true"
ServicePath="WebService.asmx"
ServiceMethod="GetCompleteList">
</cc1:AutoCompleteExtender>
WEB:
[WebMethod]
public string[] GetCompleteList(string prefixText, int count)
{
DataSet ds = new DataSet();
ds = dt("select top " + count + " code from test where code like '"+prefixText.Trim()+"%'");
List<String> list = new List<string>();
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
list.Add(dr[0].ToString().Trim());
}
}
return list.ToArray();
}
--------------------编程问答-------------------- TextBox 放到外头去 !!
就是这样!!
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="TextBox1"
CompletionSetCount="12"
EnableCaching="true"
MinimumPrefixLength="1"
ServicePath="sql_test.asmx"
CompletionListElementID="Panel1"
ServiceMethod="GetCompleteList">
</ajaxToolkit:AutoCompleteExtender>
</div>
<asp:TextBox ID="TextBox1" runat="server" ForeColor="Black"></asp:TextBox>
</form> --------------------编程问答-------------------- 没有改变了,一样是这样的 --------------------编程问答-------------------- 你用了Css样式吧 这个控件你用了新的css样式 什么都会变的
最好是原装不动的试下
原装的是没问题的 --------------------编程问答-------------------- 什么都没有用啊```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="TextBox1"
CompletionSetCount="10"
CompletionInterval="1000"
EnableCaching="true"
MinimumPrefixLength= "1"
ServicePath="WebService.asmx"
CompletionListElementID= "Panel1" ServiceMethod="GetCompleteList"
>
</cc1:AutoCompleteExtender>
<asp:TextBox ID="TextBox1" runat="server" ForeColor= "Black"></asp:TextBox>
</form>
</body>
</html> --------------------编程问答-------------------- 自己顶 --------------------编程问答-------------------- 我最近也在研究这个东东 --------------------编程问答-------------------- 顶一下。学习了。 --------------------编程问答-------------------- 我用这个控件也用不起来,读取文件里的内容进行提示可以,但读取数据库的不行
补充:.NET技术 , ASP.NET