We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom cell formatting with IFormatProvider

Thread ID:





100511 Aug 11,2011 03:54 PM UTC Aug 29,2011 02:27 PM UTC ASP.NET Web Forms (Classic) 5
Tags: GridGroupingControl
Anthony Constantinou
Asked On August 11, 2011 03:54 PM UTC

Is there a way to use an IFormatProvider to dictate cell format rather than the GridStyleInfo.Format string.


Eswari S [Syncfusion]
Replied On August 16, 2011 09:22 AM UTC

Hi Anthony,

Thanks for using Syncfusion products.

Sorry for the inconvenience caused. Before we start providing the solution, we would like to hear the platform using by you(eg : Grid[windows] or Grid[Web]).

Could you please provide us the above details so that we could provide you a better solution? The information provided would be of great help in resolving the issue.

Please let us know if you need any further assistance.


Anthony Constantinou
Replied On August 16, 2011 12:33 PM UTC


I am using Grid for Windows Forms, sorry I posted the question in the wrong forum.


Ragamathulla B [Syncfusion]
Replied On August 18, 2011 11:30 AM UTC

Hi Anthony,

We regret deeply for the delay.

The IFormatProvider interface supplies an object that provides formatting information for formatting and parsing operations. Formatting operations convert the value of a type to the string representation of that value. Typical formatting methods are the ToString methods of a type, as well as Format. Parsing operations convert the string representation of a value to a type with that value. Typical parsing methods are Parse and TryParse.

You can handle the TableControlDrawCellDisplayText event and conditionally set the e.Inner.DisplayText to "Yes" or "No".
Here is the code snippets:

GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if (style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.Name == "History" && style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
if (e.Inner.Style.Text == "True")
e.Inner.DisplayText = "Yes" ;
else if (e.Inner.Style.Text == "False")
e.Inner.DisplayText = "No";

Please let me know if any other concern.

Ragamathullah B.

Mrudang Majmudar
Replied On August 25, 2011 05:11 PM UTC

i have similar requirement for WPF DataGrid.

basically i want to do custom formatting
with CellType = UpDownEdit


Also how to control increment size
for up/down

Jawahar Jeevanandan J [Syncfusion]
Replied On August 29, 2011 02:27 PM UTC

Hi Mrudang,

We can apply custom format to UpDownEdit control as follows.

Please find the sample attached in the below link.

Please let us know if you have any queries.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon