Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1530
Changing Datatype in edit mode
posted

 

I need to change the datatype of the selected cell to be able to use a custom editor. Is this possible?

Background:

My business objects have a lot of complex properties with lots of information about how to handle the real value itself. For these properties I have a custom editor I want to use for editing data in the datagrid.

For memory purposes I can't use a list of that complex datatype as grids datasource. So i build up a list with just the values as strings for rendering the records.

Entering editmode I extract the needed information from field label and reconstruct my business object. Now I want to use the complex property type as source for my custom editor.

Here is a modified HostAnyControl solution to for reproducing the problem in a smaller environment.

 

Setting the fields EditAsType to System.String, the values in the fields columns are displayed.

 

pointField.Settings.EditAsType = typeof(String);

But if I set the cell.value to data of ComplexDataType when EditModeStarting raises, the editor just gets the data casted to string and the values will not be used.

Setting the EditAsType to typeof(ComplexDataType) the field values of type string won't be shown in the fields column.

pointField.Settings.EditAsType = typeof(ComplexDataType); 

 

For all reading an article from the beginning to the end before downloading anythif, here again the sources for the sample project:

Hope anyone can help....