Current filter:
                                You should refresh the page.
                                Support Center
                                  • ´╗┐Hello,

                                    SearchLookUpEdit is created and bound to datasource this way:

                                    var fieldList = (from d in ctx.v_kt_akt select d).ToList();
                                    BindingSource bs = new BindingSource() { DataSource = fieldList };

                                    SearchLookUpEdit edit = new SearchLookUpEdit();
                                    edit.Properties.DataSource = bs;
                                    edit.Properties.DisplayMember = "KT_ETYKIETA";
                                    edit.Properties.ValueMember = "KT_ID";
                                    edit.Properties.View.Columns.AddVisible("KT_ETYKIETA").Caption = "Etykieta klauzuli";
                                    edit.Properties.View.Columns.AddVisible("KT_SYMBOL").Caption = "Symbol klauzuli";

                                    As you can see, "KT_ETYKIETA" database field is set as displayed member and "KT_ID" as ID and used as parameter value to filter report - it should be done by id. It works.

                                    But, there is also database field named "KT_ETYKIETA" and I need to get its value from SearchLookUpEdit. I want to avoid unnecessary database query to get "KT_ETYKIETA" value by id. Instead, I want to get this column value from SearchLookUpEdit.

                                    I can do this with LookupEdit, wchich I used befor, with following code:

                                    string val = (string)GetColumnValue("KT_ETYKIETA")

                                    It returns KT_ETYKIETA value for selected row.

                                    How to do the same with SearchLookUpEdit control? There is no GetColumnValue (or any equivalent) method. I can only get ValueMemever column value for selected row. How can I get other columns values directly from control? Is this possible?

                                1 Solution

                                Creation Date Rating Importance Sort by

                                You can use the GetDisplayValueByKeyValue method to get a value of the DisplayMember by ValueMember.

                                object displayMemeber = searchLookUpEdit.Properties.GetDisplayValueByKeyValue(searchLookUpEdit.EditValue);

                                To get a value of another column, use the SearchLookUpEdit view's GetRowCellValue method.

                                Show all comments
                                • Michal Olszewski 06.28.2012


                                  Thanks for your solution. I can get value of display member using this method. But, is this possible to get value for other columns added to search lookup edit's grid?

                                • Michal Olszewski 06.29.2012

                                  How can I get selected row handle neede for GetRowCellValue ?

                                • Hi,

                                  To access a selected row index, use the RepositoryItemSearchLookUpEdit.GetIndexByKeyValue method. Then, you will be able to obtain this row from an underlying datasource.

                                  We hope that you find this information helpful.

                                • Toto Surya 01.23.2013

                                  If I use that. It's only return Display Member. How can I get Value Member?

                                • Andrew Ser (DevExpress Support) 01.23.2013

                                      To get the selected row handle, use the GridView.FocusedRowHandle property. Use the SearchLookUpEdit.Properties.View property to access the GridView. The GetRowCellValue method also requires a column or its field name. You can use the ValueMember, DisplayMember, or any other column field name.
                                      As a result, you can get any value in the following manner:

                                  GridView view = searchLookUpEdit1.Properties.View; int rowHandle = view.FocusedRowHandle; string fieldName = "Name"; // or other field name object value = view.GetRowCellValue(rowHandle, fieldName);
                                      If the SearchLookUpEdit's popup has never been opened, the GetRowCellValue will return null, because the GridView has not been initialized.
                                  I hope you find this information useful. We are looking forward to your response once you try this solution.

                                • Toto Surya 01.25.2013

                                  I still confused. this is my example code :


                                  ---On Form Load---
                                  lookup.Properties.DataSource = Nothing
                                  Adapter = New MySqlDataAdapter(strSQL, Conn)
                                  slookup.Properties.DataSource = Dt
                                  slookup.Properties.DisplayMember = Display
                                  slookup.Properties.ValueMember = Value
                                  slookup.EditValue = edit

                                  ---On SearchLookupEdit_EditValueChanged---
                                  displayMember = slookup.Properties.GetDisplayTextByKeyValue(slookup.EditValue)

                                  ---On Button1_Click---

                                  If I use my code, It's only view Display Member in EditValue. I would like to know the Key Value Member is in that object. Whereas, in the GridView there is a key in another filed.

                                  And if I use your solution, I can't get value return of Object Value. Please help me or give me example project. Thanks

                                • Hi Michal,
                                  I have created a sample that demonstrates the approach Andrew suggested, please find this project in the attachment.

                                  I would like to note that you can use the GridView.GetRowCellValue method only after a grid view has been initialized; in other words, after the SeachLookUpEdit's popup window has been opened for the first time. In the opposite case, use methods provided by the editor's datasource. Please refer to the Why the GridLookUpEdit's View returns incorrect values starting with version 10.2 article for more information.

                                  I hope this project will be helpful to you. Feel free to contact us if you have further difficulties. We are happy to help you at any time.

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners