GridViewTextboxColumn int value

5 posts, 0 answers
  1. Emmanuel Dugas-Gallant
    Emmanuel Dugas-Gallant avatar
    8 posts
    Member since:
    Mar 2010

    Posted 26 Aug 2010 Link to this post

    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,
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 01 Sep 2010 Link to this post

    Hi Emmanuel Dugas-Gallant,

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Carol Watson
    Carol Watson avatar
    21 posts
    Member since:
    Jan 2010

    Posted 06 Dec 2010 Link to this post

    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
  5. Svett
    Admin
    Svett avatar
    728 posts

    Posted 08 Dec 2010 Link to this post

    Hello Carol,

    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
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
  6. Carol Watson
    Carol Watson avatar
    21 posts
    Member since:
    Jan 2010

    Posted 08 Dec 2010 Link to this post

    Thanks Svett ... that works....
Back to Top
UI for WinForms is Visual Studio 2017 Ready