User (Old forums)MemberJune 13, 2008 at 11:55 amPost count: 23064
I have an Xceed grid that I use to display values from properties on objects contained in an IList. I use DataBoundColumns to link the object properties to the Grid’s columns and this works nicely.
However, I would like to be able to override the value provided by the binding on certain occasions. On these occasions, I would simply like to provide the text that I want the cell to display without that value being copied back to the property that the cell is bound to. I thought it might be something as simple as…
dataRow.Cells[BoundColumnName].Value = “MyOwnTextHere”
…but I’ve noticed that the cell value does not change when I do this.
Could you please advise whether it’s possible to tell the grid cells to display text that differs from the actual cell value? Or alternatively, is it possible to set the cell’s value to something different to the property value it is bound to without updating the actual property?
Imported from legacy forums. Posted by russellcoombes (had 672 views)User (Old forums)MemberJune 16, 2008 at 11:13 amPost count: 23064
If you don’t want the DataSet to which the grid is bound to be updated when changing the cell value, the only solution we can think of is to use a CellViewerManager on the column, and use the SettingControlValue event to set the value so the the cell itself always has the “true” value, but the viewer is set with a different value.
gridControl1.Columns[ “column1” ].CellViewerManager.SettingControlValue += new CellViewerEventHandler( CellViewerManager_SettingControlValue );
void CellViewerManager_SettingControlValue( object sender, CellViewerEventArgs e )
if( e.Cell.Value == “some value” )
e.Control.Text = “Different value”;
Imported from legacy forums. Posted by André (had 352 views)User (Old forums)MemberJune 18, 2008 at 8:24 amPost count: 23064
Thanks for your answer.
I have tried what you have mentioned by creating the CellViewerManager manually:
grid.Columns[“MyColumnName”].CellViewerManager = new CellViewerManager(new WinTextBox(EnhancedBorderStyle.None), “Text”);
Afterwards, as recommended, I use the SettingControlValue event to set the value and this works nicely. I tried setting this value in other events/methods and it did not work, so I now realise why setting this value in this event is important.
Thanks very much for fixing this issue for us.
Imported from legacy forums. Posted by russellcoombes (had 1037 views)
- You must be logged in to reply to this topic.