Lookup Field without relationships

Hello -

The data set I’m working with does not have foreign key relationships defined and they are not able to be added. But there are primary key and unenforced related key entries. How can I create a lookup field in this situation? This addresses it if there are related entities, but not without. Lookup Value from Data Grid

Thank you.

Hi,

Do you want to create a Form lookup field manually? If yes you can check the TestSampleService app that Radzen ships with. Select the Edit Order Detail page.

Initially it loads the related entities. In this case Products and Orders:

Then it creates defines two lookup form fields. Here is how the Product lookup field looks like:

The important properties are:

  • Type - specifies the editor UI. In this case lookup.
  • Property - the name of the foreign-key (relationship) property (mapped to a DB table column). In this case ProductID
  • Data - the items the user can pick from. They are retrieved when the page loads using the actions from the first screenshot: 3) Invoke data source method getProducts then set getProductsResult
  • TextProperty - the property (DB table column) to display as text in the lookup dropdown
  • ValueProperty - the property (DB table column) which the foreign key maps to. Usually the primary key or unique identifier of the table. In this case it is the ID column of the Products table.

You can adapt this setup to your case.

Best regards,
Atanas

I’ll try it. Thank you.