public string[] GetLocationInfo(string prefixText) { int count = 10; string sql = "Select * from Locations Where Location like @prefixText"; SqlDataAdapter da = new SqlDataAdapter(sql,webindia.Connstring); da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText+ "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Location"].ToString(),i); i++; } return items; }
<asp:TextBox Maxlength="50" id="txtname2" class="bdtxt" onblur="this.value=Trim(this.value)" onkeypress="return noNumbers(event)" runat="server"/>
<cc1:AutoCompleteExtender CompletionListCssClass="Completer_completionListElement FS-NBK" CompletionListItemCssClass="Completer_listItem" CompletionListHighlightedItemCssClass="Completer_highlightedListItem" ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ShowOnlyCurrentWordInCompletionListItem="true" ServiceMethod="GetLocationInfo" FirstRowSelected="true" ServicePath="WebService.asmx" TargetControlID="txtname2"> </cc1:AutoCompleteExtender>
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: