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

Custom Formatter Provider with a GridBoundColumn

1 Answer 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 14 Apr 2011, 01:05 PM
I have a simple RadGrid control a web page connecting to a view via a data source.  One of the fields requires a special formatting.

I was wondering is there a way to tell the GridBoundColumn to use a particular class when executing the DataFormatString property on the data at Binding Time.

For example, here is an example of data from the view
AccNumber (long), Name (string), OpenDate (datetime)
931367200, Bob Smith, 9-Sep-2010
911405190, Sue Smith, 8-Sep-2009
734412678, Tony Mendica, 3-Jan-2001

What I want the grid to display the fields is as follows:
931 367 200      Smith, Bob        9-Sep-2010
911 405 190      Smith, Sue        8-Sep-2009
734 412 678 L   Mendica, Tony  3-Jan-2001

The account for Tony is special as it has long standing customer privileges, so I would like to use a custom formatter class that implements the IFormatProvider interface.

I have considered using the ItemDataBound event and providing the customer format hook in there - however, i would prefer to avoid that if possible.

Thoughts?
j.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 20 Apr 2011, 08:02 AM
Hi Jeff,

Adding custom formatting classes is not supported for the GridBoundColumn in the current version of RadGrid. If you need more control over the formatting you should use a server-side event such as ItemDataBound. Another option might be extending the GridBoundColumn and creating your own custom column that supports the desired functionality.
More information on formatting in RadGrid can be found in this help topic

Kind regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or