Skip to content

Devextreme, dxLookup, get the value of a selected row #4784

Closed

Description

@itg-assistant

Per Olsson asked 2025-05-28 08:42:03 UTC

Hi,

How do I get the value of the selected row in a dxLooukup widget?
The code below does not work.

Dim retValue = dxLookup1.Eval("this.widget.option('value')")

Thanks,
Per

Activity

  1. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Julie (ITG) answered 2025-05-28 15:48:45 UTC

    • You can attach to the onSelectionChanged event like so:
    dxLookup1.Instance.onSelectionChanged += new WidgetEventHandler(this.dxLookup1_onSelectionChanged);private void dxLookup1_onSelectionChanged(object sender, WidgetEventArgs e)
    {
    AlertBox.Show(e.Data.ToJSON());
    

    }

    • You can use optionAsync to get the value: (must be async because we expect a value back.)
    int value = await dxLookup1.Instance.optionAsync("value");
    AlertBox.Show(value.ToString());
    
    • If you want to change the selected value via code, you can do it like so: (where 2 is the new value to be set)
    dxLookup1.Instance.option("value", 2);
    

    See attached sample.

  2. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Per Olsson answered 2025-05-28 18:52:34 UTC

    Excellent, Julie!

    That worked perfectly. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions