AjaxControlToolkit AutoCompleteExtender实例应用

<td class="style23">
<asp:TextBox ID="tbNum" BackColor="#CCFFFF" runat="server" AutoCompleteType="Disabled"
Width
="289px"></asp:TextBox>
<asp:AutoCompleteExtender ID="tbNum_AutoCompleteExtender" runat="server" FirstRowSelected="true"
Enabled
="True" ServicePath="Infor.asmx" ServiceMethod="GetTableInfor"
TargetControlID
="tbNum" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="10"
CompletionInterval
="100" UseContextKey="True">
</asp:AutoCompleteExtender>
</td>

Infor.asmx文件

[WebMethod]
public string[] GetTableInfor(string prefixText, int count)
{
string SQL_STR = "select top 10 ProNum from Tables where ProNum like '%" + prefixText + "%'";
DataSet ds
= SQLHelper.Query(SQL_STR);
count
= ds.Tables[0].Rows.Count;
string[] array = new string[count];
for (int i = 0; i < count; i++)
{
array[i]
= ds.Tables[0].Rows[i]["NumName"].ToString();
}
return array;

}
posted @ 2011-07-05 10:24  Jack Qin  阅读(261)  评论(0)    收藏  举报
作者:Jack Qin http://www.nosqlcn.com