Emmanuel Dugas-Gallant
Top achievements
Rank 1
Emmanuel Dugas-Gallant
asked on 26 Aug 2010, 06:43 PM
I'm trying to make a GridView column usable for int properties.
I have actually a property defined as an "int". When I binded my DataSource to the GridView component, the column linked to the "int" field has been created as a GridViewDecimalColumn.
But, when I try to edit the column field, I have an exception saying: Object of type "System.Decimal" cannot be converted to type "System.Int32"
Did I missed something?
Thanks,
I have actually a property defined as an "int". When I binded my DataSource to the GridView component, the column linked to the "int" field has been created as a GridViewDecimalColumn.
But, when I try to edit the column field, I have an exception saying: Object of type "System.Decimal" cannot be converted to type "System.Int32"
Did I missed something?
Thanks,
4 Answers, 1 is accepted
0
Hi Emmanuel Dugas-Gallant,
I suppose that the GridViewDecimalColumn is not initialized appropriately. Have you tried to set the DataType property:
This is needed by the grid's conversion layer to process value formatting and parsing. You can read more about the conversion layer capabilities in this blog post.
If you still experience the issue, please send us a code snippet that demonstrates how you create the columns and how you bind and create the RadGridView instance.
All the best,
Svett
the Telerik team
I suppose that the GridViewDecimalColumn is not initialized appropriately. Have you tried to set the DataType property:
decimalColumn.DataType =
typeof
(
int
);
This is needed by the grid's conversion layer to process value formatting and parsing. You can read more about the conversion layer capabilities in this blog post.
If you still experience the issue, please send us a code snippet that demonstrates how you create the columns and how you bind and create the RadGridView instance.
All the best,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Carol Watson
Top achievements
Rank 1
answered on 06 Dec 2010, 07:11 AM
Hi I am a VB.Net User and I have the same problem. I have tried your code snippet to have my grid work but the direct conversion from C# to VB does not work.
my converted code looks like
DecimalColumn.DataType = TypeOf(Integer)
Could you convert this work around for me?
Thank you
my converted code looks like
DecimalColumn.DataType = TypeOf(Integer)
Could you convert this work around for me?
Thank you
0
Hello Carol,
Greetings,
Svett
the Telerik team
The Visual Basic equivalent of the code snippet provided in the last post is:
decimalColumn.DataType =
GetType
(
Integer
)
I hope this helps.
Greetings,
Svett
the Telerik team
0
Carol Watson
Top achievements
Rank 1
answered on 08 Dec 2010, 04:29 PM
Thanks Svett ... that works....