Hello,
Can anyone help me figure out how I can grab a single key value when a user selects the desired row from a AutoCompleteExtender control with multiple fields?
The example I am looking for is when the user types in the company name "Eddie's Used Cars" in the texbox, the AutoCompleteExtender will display the following values:
Eddie's Used Cars / Phoenix / AZ / 800-111-1111
Eddie's Used Cars / ST Antonio / TX / 800-222-2222
Eddie's Used Cars / San Diego / CA / 800-333-3333
I currently have my AutoCompleteExtender to display additional fields, but when the user selects the desired row I cannot return a single value "Primary Key" from the database.
I need this value to be return in order for my gridview to be displayed.
Before I added the addition fields to be displayed in the AutoCompleteExtender I was able to return a single value.
Here is the JavaScript:
<scripttype="text/javascript">
function
ace1_itemSelected(sender, e) {
var
ace1Value = $get('<%=
ace1Value.ClientID %>');
ace1Value.value = e.get_value();
}
Client Side code:
<asp:TextBox
ID="txtSearchBox"
runat="server"
Width="77%"/>
<asp:AutoCompleteExtender
ID="ace1"
TargetControlID="txtSearchBox"
ServiceMethod="GetSuggestions"
MinimumPrefixLength="1"
DelimiterCharacters=""
OnClientItemSelected="ace1_itemSelected"
FirstRowSelected="true"
runat="server"
CompletionListCssClass="auto-complete1"
CompletionSetCount="1000000000"
EnableCaching="False"
CompletionInterval="3"
CompletionListHighlightedItemCssClass="auto-complete3"
CompletionListItemCssClass="auto-complete2"
OnClientShowing="showing"
ShowOnlyCurrentWordInCompletionListItem="True"/>
<asp:HiddenField
ID="ace1Value"
runat="server"/>