Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
12227 | Mar 24,2004 11:57 AM UTC | Mar 25,2004 12:21 PM UTC | WinForms | 6 |
![]() |
Tags: GridControl |
this.someLookupColumn_m.StyleInfo.ValueMember = "";
What this will do is make the grid use the actual object from the DataSource as the value which is what you indicate should be in the cell when you set CellValueType.
This should make the value in the grid be the parent EntityID and not the child EntityID.EntityID.
If you really do want it to be the child EntityID.EntityID, then I think you will have to do something like handle CurrentCellValidating, get the text from the current cell using grid.CurrentCell.Renderer.ControlText. Then code something that will take that text and retrieve the EntityID.EntityID that you want associated with the text. Once you have the proper EntityID, then you would call renderer.SetControlValue to make the combobox have your EntityID object as its value instead of whatever text the user typed in. I did not try this so I am not sure if CurrentCellValiding is the right place or not, or what other problems you might run into as you code this.
this.someLookupColumn_m.StyleInfo.CellValueType = typeof(MyCompany.Business.Lookup.SomeLookup);
this.someLookupColumn_m.StyleInfo.ValueMember = "EntityID";
The CellValueType should be the type of the object in the grid column. The second line says that the property named "EntityID" is to be used to provide the object for the grid cell when you use the dropdown. Is the property named "EntityID" of type MyCompany.Business.Lookup.SomeLookup?
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.