Custom Formatter Provider with a GridBoundColumn

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    10 posts
    Member since:
    Oct 2010

    Posted 14 Apr 2011 Link to this post

    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.

  2. Marin
    Marin avatar
    1038 posts

    Posted 20 Apr 2011 Link to this post

    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,
    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top