Grid DataSource with Null values throws error

3 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    15 posts
    Member since:
    Nov 2007

    Posted 10 Dec 2008 Link to this post

    The datasource for my RAD Grid is a datatable with a column that is typed to System.Double. This column allows null. However when this datatable is bound to the grid it results in a

    Conversion from type 'DBNull' to type 'Integer' is not valid

    error. I am unable to trace the exact line where this error is raised. How do I specify that a grid column can have null data. If the column type is System.String, then the grid can handle nulls as designed. For numeric columns with nulls the grid bombs

    Please advise

    TIA



  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 15 Dec 2008 Link to this post

    Hi Ramesh,

    Can you please check whether the same error is generated when binding your source field column to a regular MS GridView instance on the page? If the exception is raised with RadGrid only, I will appreciate if you prepare a small working project, illustrating the abnormality, and send it enclosed to a formal support ticket. We will test/debug it locally and will get back to you with our findings.

    Kind regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ramesh
    Ramesh avatar
    15 posts
    Member since:
    Nov 2007

    Posted 15 Dec 2008 Link to this post

    Sebastian
    Thank you for your response. During the course of creating a sample project to reproduct the issue, I discovered that the error was in fact in my code and not the grid. The crytpic error message regarding DBNull and not seeing the break happen in my code led me on a tangent to suspect the issue to be in Telerik code. I have fixed my code and now the grid is working as intended

    thanks
    ramesh
Back to Top