This is a migrated thread and some comments may be shown as answers.

Grid Column DataType problem

7 Answers 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 03 Jul 2009, 02:42 PM

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;

 

 

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 06 Jul 2009, 11:41 AM
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.
0
Richard
Top achievements
Rank 2
answered on 06 Jul 2009, 12:15 PM
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?

0
Pavlina
Telerik team
answered on 08 Jul 2009, 02:51 PM
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.
0
Mark Galbreath
Top achievements
Rank 2
answered on 08 Oct 2009, 04:56 PM
This is ridiculous.  Why is there not a single example or explanation of how to programatically assign the datatype to a column?
0
Pavlina
Telerik team
answered on 13 Oct 2009, 05:29 PM
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.
0
Terry
Top achievements
Rank 1
answered on 08 Mar 2019, 01:46 AM

Pavlina,

I've been searching for the same things for a week now, 10 years after this post, and the article you mentioned says nothing about setting the datatype to a programmatically generated GridBoundColumn.

0
Eyup
Telerik team
answered on 12 Mar 2019, 07:31 AM
Hello Terry,

You can use the ColumnCreated event handler to modify the settings of auto-generated columns:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/columns/working-with-autogenerated-columns#customizing-auto-generated-columns

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Richard
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Richard
Top achievements
Rank 2
Mark Galbreath
Top achievements
Rank 2
Terry
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or