Hi,
I have a XtraGrid which has as datasoure a BindingSource.
The DataSource of te BindingsSource is a BindingList of objects.
One of the properties of my object is a long, so the colum in the grid is shown as a number.
I have aded a repositoryItemLookUpEdit which is use as EditItem for the above column
During runtime I assign the DataSource to the repositoryItemLookUpEdit, with a DisplayMember (string) and ValueMember (long)
First question :
When clicking a cell in the column the dropdown is opened, but why are all columns of the repositoryItemLookUpEdit datasource are shown in the dropdown an not only the DisplayMember ?
Second quenstion :
When selecting an item from the dropdown, the selected value is not shown in the xtragrid cell. It just remains "N/A", which is my nullvaluetext.
PS : I have added a screedump to make things clear.
Hi,
I suppose to problem is already that my datagrid column is a number, but I want to show a text for it.
Is there anyway I can use the same datasource (displaymember and valuemember) for this as I do in the RepositoryItemEditLookup ?
Hello,
The RepositoryItemLookUpEdit.DisplayMember property determines a field of the LookUpEdit's data source whose values will be displayed in the text area. To hide columns, use the Visible property:
RepositoryItemLookUpEdit ritem = new RepositoryItemLookUpEdit(); ritem.PopulateColumns(); RepositoryItemLookUpEdit.Columns[0].Visible = falsel; ...
When selecting an item from the dropdown, the selected value is not shown in the xtragrid cell
Usually this issue occurs if the selected value isn't contained in the LookUpEdit's data source. I assume it is caused by the approach that you are using to redefine the LookUpEdit's data source. Would you please send us a simple project illustrating the issue? This information will allow us to find an appropriate solution faster.
I hope to receive your response soon.
Hi,
Thanks.
I have added the columns for the RepositoryItemsEditLookup using the designer, so they are no created during runtime (when assigning the datasource). This works just fine.
What concerns the second question.
My grid is bound to an list of objects (BindingList). The properties of my object are all integers, so the grid creates columns and shows integers for the cell values.
The idea was not to show integers but some text, just as you do using a displaymember and valuemember in the ReposirotyItemsEditLookup.
Hope this clarifies my questions, if not, please let me know.
Hi Andrew,
Indeed, it was a probleem with my datasource.
Thanks for helping me out.
Hi Andrew,
Just an extra little questions.
I have as null value for the ItemReposirotyLookupEdit the text "N/A".
Once the user has selected a value, is there a way he can go (select ?) back to the "N/A" null value ?
Helllo David,
If you wish to set a null value to the LookUpEdit, you may use the Ctrl + Del key combination. It is also necessary to turn on the AllowNullInput property.
I hope you will find this information useful.