KB Article A495
Visible to All Users

How to obtain the selected row from the LookUp editor

Description:
How to obtain the selected row from the LookUp editor? I want to obtain the selected row's value and display it in a label.

Answer:
The current key value is stored in the editor's EditValue property. If you need to obtain a row object by a given key, you should use the GetDataSourceRowByKeyValue method of the RepositoryItemLookUpEdit. Here is the code:

C#
object row = lookUpEdit1.Properties.GetDataSourceRowByKeyValue(lookUpEdit1.EditValue); label1.Text = (row as DataRowView)["Description"].ToString();

See Also:
How to obtain a value for a specific column within the LookupEdit which corresponds to the currently selected row
How to implement an incremental search feature for an edit form via the LookUpEdit

Show previous comments (5)
DevExpress Support Team 10 years ago

    Hello,

    To process your recent post more efficiently, I created a separate ticket on your behalf: T189359: How to Retrieve the Value Corresponding to the Currently Selected Display Value of the RepositoryItemGridLookUpEdit???. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

      Would you so kind to share the solution for us all?? im also looking for the How to Retrieve the Value Corresponding to the Currently Selected Display Value of the RepositoryItemGridLookUpEdit???

      DevExpress Support Team 10 years ago

        Hello,

        The thread in the previous comment is marked as private and I cannot make it public without its author's agreement. Therefore, I have created a separated thread on your behalf. Let us continue our discussion there GridLookUpEdit - How to Retrieve the Value Corresponding to the Currently Selected Display Value?.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.