ASP.NET AJAX AutoCompleteExtender - Text/Value Pairs

I've got the AJAX AutoCompleteExtender working on my page, however when the user selects a customer name from the list I need the textbox to pass the customer ID value and not the name?

Is there a way to do this?  

My code is attached.  The CUSTOMID is the ID and the SOLDTO is the Customer name that appears in the list.
codesnippet.txt
cdemott33Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

meetingexpectationsCommented:
You can save the result into a datatable and either cache it or store it in session. Then on "txtCustomerSearch" textbox changed event Filter the datatable according to your selection to get the customid. If you need example, please let me know.
0
masterpassCommented:
you can make use of the contextkey that is available .... But you can't use it with the textbox .. To use that you might need a dropdownlist

http://www.aspdotnetcodes.com/AutoComplete_Textbox_Addtional_Parameters.aspx
0
masterpassCommented:
A small typo .. You can use  with the textBox but will an additional dropdownlist

http://www.aspdotnetcodes.com/AutoComplete_Textbox_Addtional_Parameters.aspx
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

cdemott33Author Commented:
I think you may not have understood what I'm attempting to do.  I need to the user type in a customer name and then, when the user hits submit, the customer ID is passed?  Make sense?

My db is something like this

ID  |  Customer Name
1   |  Walbaums
2   |  Walmart
3   |  Walnut Shoping Center

Basically, if the user enter "Wal" in the textbox and selects "Walmart" from the list I want to pass the Walmart ID (in this case the number 2) and not the name.  
0
masterpassCommented:
Yes, you can very well do that. For that you have implement CreateAutoCompleteItem

When you are adding the data to be returned, use CreateAutoCompleteItem
While sdr.Read
    customers.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(sdr("SOLDTO").ToString(), sdr("CUSTOMID").ToString()))
End While

Open in new window

0
cdemott33Author Commented:
Thanks masterpass.  I've added the code to my page but I'm still not sure how, after the user selects a value from the list, do I get the CUSTOMID rather than the SOLDTO value?  Can you give me a bit more detail on how I accomplish this?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.