This is a migrated thread and some comments may be shown as answers.

[Solved] values and text option

3 Answers 68 Views
AutoCompleteBox for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kieran C
Top achievements
Rank 1
Kieran C asked on 08 Oct 2014, 01:13 PM

Hi,

I have been using the autobox where I just had text options in the box but now I need to put a value behind each text option.  I was using a string List and then the following to populate the box - radboxClients.ItemsSource = list1

How would I populate the autobox so I will be able to select the value as well as the text when the user makes a selection.  I have my value (id) and my text (account_name) in the below class...so I will be looking at how to populate the autobox from the below queryResult. 

Thanks


​  Dim context = New Telerik.Storage.Extensions.Context("HandheldsK3_DB", Telerik.Storage.Extensions.DatabaseLocation.Local)
        Dim queryResult = context.[Get](Of class_Conns.customersCustom1)("Select account_name, id from test1")
        context.SaveChanges()
        context.CloseDatabase()

3 Answers, 1 is accepted

Sort by
0
Kieran C
Top achievements
Rank 1
answered on 08 Oct 2014, 02:16 PM

Sorry I meant to say that the user should only see the text option and not the value option...like in a normal .net drop down box. 
0
Ivaylo Gergov
Telerik team
answered on 13 Oct 2014, 08:04 AM
Hello Kieren,

In this case the RadAutoCompleteBox.ItemsSource should be a collection of the result data class of the query. For such scenarios, The RadAutoCompleteBox exposes FilterMemberPath and DisplayMemberPath properties. The FilterMemberPath property is used to point the property of your data that is used to filter the suggestions and the DisplayMemberPath property is used to point the property of your data that is used to display the suggestions.
In your scenario both properties should be set to "account_name". Thus, when a user makes a selection, he will see and filter by account_name, but the selected item in the code will be the whole data class.

I hope this helps. Let me know should you need further assistance.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kieran C
Top achievements
Rank 1
answered on 20 Oct 2014, 02:42 PM

Thanks for that Ivaylo
Tags
AutoCompleteBox for XAML
Asked by
Kieran C
Top achievements
Rank 1
Answers by
Kieran C
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Share this question
or