Grid Column DataType problem

6 posts, 0 answers
  1. Richard
    Richard avatar
    63 posts
    Member since:
    Apr 2008

    Posted 03 Jul 2009 Link to this post

    In my database I have a column called "Current_Due" which is set as a numeric datatype (Oracle).  When I autogenerate my grid, the column is being typed as a GridBoundColumn instead of a GridNumericColumn. 

    1.)  Do I need to change something to have it bind as a different column type?

    2.)  In my RadGrid1_ColumnCreated event, I try to cast it as a GridNumericColumn and get an error.  Anyone know how to cast as a different column type?  I'm doing - GridNumericColumn numericColumn = e.Column as GridNumericColumn;

     

     

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 06 Jul 2009 Link to this post

    Hi Richard,

    When the columns in RadGrid control are autogenerated, please have in mind that you can not change their type. In order to achieve your goal you can dynamically create GridNumericColumn in code behind on Page_Init / RadGrid1_ColumnCreated event.
    Find more information in this help article.

    Best wishes,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Richard
    Richard avatar
    63 posts
    Member since:
    Apr 2008

    Posted 06 Jul 2009 Link to this post

    Thank you for your response Pavlina.  Can you tell me why data which is of Numeric Type to begin with is not being bound as a GridNumericColumn type in the first place?  If the data type is set as numeric in the data source, the grid should know that and automatically select the GridNumericColumn  type when constructing the grid.  Any ideas?

  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Jul 2009 Link to this post

    Hello Richard,

    Attached to this message is a simple runnable application, that demonstrates the needed approach. Please give it a try and let me know if it helps.

    Greetings,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 08 Oct 2009 Link to this post

    This is ridiculous.  Why is there not a single example or explanation of how to programatically assign the datatype to a column?
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 13 Oct 2009 Link to this post

    Hello Mark,

    Please review the following help topic on how to create RadGrid programmatically.
    http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html

    I hope this helps.

    Regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017