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

Get the selected records entire row dataset

1 Answer 53 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 09 Nov 2017, 04:50 PM

Hi,

I'm trying to figure out a way or if it is possible to get the other values from the selected record. For example,

If i have a query setup with multiple table joins as follows:

Select table1.person_id,

table1.name,

table1.age,

table1.gender,

table2.address_id, 

table2.address_1, 

table2.address_2,

table2.address_3,

table3.something1,

table3.something2

such that it could return multiple addresses for a single person

I would have the AutoCompleteBox DataTextField set to 'name', and the DataValueField set to 'person_id'.

How would i pull the address_id value out of the selected record, or really any of the other values?

I'm able to access these within the DropDownItemTemplate using DataBinder.Eval(Container.Dataitem, "address_id") to format what the user sees, but once they click the record i cannot save away the extra information that may or may not be displayed in the template. Since the person_id can have multiple address_id's associated to it, i cannot pull that value from the field and run a separate query since I'm not able to define which address was specifically chosen.

 

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 14 Nov 2017, 02:06 PM
Hello Dan,

I am sharing the answer from the support thread for convenience and better visibility from the community. 

The DataItem is available only during DataBinding as suggested in Usage of AutoCompleteBoxEntry.DataItem

One option would be to manually get the records from the DataBase based on the Entry value. 

Another option is to add attributes to the items as demonstrated in the attached project. Keep in mind that the attributes are available only in WebService binding scenario. To run the project, the .NET 4.5 version of the Telerik.Web.UI.dll should be added to the bin folder.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoCompleteBox
Asked by
Dan
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or