Get the selected records entire row dataset

2 posts, 0 answers
  1. Dan
    Dan avatar
    1 posts
    Member since:
    Jan 2016

    Posted 09 Nov Link to this post

    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.

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    290 posts

    Posted 5 days and 18 hours ago Link to this post

    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.
Back to Top