<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
ServiceMethod="GetCompletionList" ServicePath="" TargetControlID="TextBox1"
EnableCaching="true" CompletionInterval="1000" CompletionSetCount="12"
MinimumPrefixLength="1">
</cc1:AutoCompleteExtender>
#region AutoComplete
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
//[System.Web.Script.Services.ScriptService]
public static string[] GetCompletionList(string prefixText, int count)
{
ClsBusinessLogicSocialNetwork objQryEx = new ClsBusinessLogicSocialNetwork();
ArrayList arNull = new ArrayList();
if (count == 1)
{
count = 10;
}
DataTable dt = objQryEx.SelectData("tbl_profile", "profile_name","profile_name like '"+prefixText +"%'");
string[] items = new string[dt.Rows.Count];
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i]["profile_name"].ToString();
items[i] = strName;
}
return items;
}
else
{
items[0] = prefixText;
return items;
}
}
#endregion
ServiceMethod="GetCompletionList" ServicePath="" TargetControlID="TextBox1"
EnableCaching="true" CompletionInterval="1000" CompletionSetCount="12"
MinimumPrefixLength="1">
</cc1:AutoCompleteExtender>
#region AutoComplete
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
//[System.Web.Script.Services.ScriptService]
public static string[] GetCompletionList(string prefixText, int count)
{
ClsBusinessLogicSocialNetwork objQryEx = new ClsBusinessLogicSocialNetwork();
ArrayList arNull = new ArrayList();
if (count == 1)
{
count = 10;
}
DataTable dt = objQryEx.SelectData("tbl_profile", "profile_name","profile_name like '"+prefixText +"%'");
string[] items = new string[dt.Rows.Count];
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i]["profile_name"].ToString();
items[i] = strName;
}
return items;
}
else
{
items[0] = prefixText;
return items;
}
}
#endregion
No comments:
Post a Comment