Displaying the text with DisplayMemberPath when the SelectedValuePath is saved in the database after retrrieving from database.

Hi,

I have the following scenario in my application. The Autocomplete control is bound to a DataSource and I am using 2 different columns for the DisplayPath and the SelectedValuePath.

autoComplete.DisplayMemberPath = "Value";
autoComplete.SelectedValuePath = "Code";

Let us take this as an example.

Code - M
Value- Male

Code - F
Value - Female

The autocomplete control displays Male and Female in the drop down but when selecting and saving the data in the database I  use the code so that the value saved in the database is M instead of Male or F instead of Female.

Now I have the following situation. How do i set the value back to Male when retrieving the value from the database. I would like to know how to compare the value from the database with the Datasource and set the text.

Thanks,

Rajesh.

1 Reply

SK Selva Kumar  Veerakrishnan Syncfusion Team December 20, 2017 12:32 PM UTC

Hi Rajesh,

Thank you for contacting Syncfusion Support.

We have prepared a sample based on your requirement. Please download the sample from the link given below.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SFAutoComplete_101904183502.zip

In the above sample we have used two autocomplete , one Entry and a button.

In the 1st AutoComplete text box we have used a collection of data which contains Detail of Name(Person name), Value(Gender) and Code(M/F).

In 2nd Autocomplete we have a collection of Value(Gender) and Code(M/F)

When the user select a Name in the 1st AutoComplete, then its code will be shown on the Entry.

By clicking the button, we can retrieve the Value(Gender) on the 2nd AutoComplete.

If the sample does not meet your requirement, please update us with more details as given below.

1. The custom object that is bind to the autocomplete
2. Detail explanation of your requirement.
This could help us to provide better solution on your requirement.

Regards,

Selva Kumar V.

Loader.
Up arrow icon