Ticket Q460763
Visible to All Users

How to access a selected lookup value in a grid

created 11 years ago

How to obtain the selected row from the LookUp editor? is it possible to do same in gridview ??

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi,
To learn how to access values in a grid, I recommend reading through the Obtaining and Setting Cell Values help article.
We hope that you find this information helpful.

    Show previous comments (6)
    Andrew Ser (DevExpress Support) 11 years ago

      Hello,
      I see in your second screenshot that the event handler is called repositoryItemGridLookUpEdit1_EditValueChanged.
      Does this handler refer to the RepositoryItemGridLookUpEdit class instance? If so, it is not correct to cast the sender to the LookUpEdit class. Cast it to the GridLookUpEdit class:

      C#
      GridLookUpEdit lookUpEdit = sender as GridLookUpEdit; DataRowView selectedDataRow = (DataRowView)lookUpEdit.GetSelectedDataRow();

      I hope you find this information useful and am looking forward to your results.

        Hi,
        Thank you very much, That's work fine.

        Andrew Ser (DevExpress Support) 11 years ago

          You're welcome. I'm happy to hear that my assistance was helpful to you.

          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.