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.
Unfortunately, activation email could not send to your email. Please try again.

Custom cell formatting with IFormatProvider

Thread ID:

Created:

Updated:

Platform:

Replies:

100511 Aug 11,2011 11:54 AM Aug 29,2011 10:27 AM ASP.NET Web Forms (Classic) 5
loading
Tags: GridGroupingControl
Anthony Constantinou
Asked On August 11, 2011 11:54 AM

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

Thanks,
Anthony


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

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.

Regards,
Eswari.S


Anthony Constantinou
Replied On August 16, 2011 08:33 AM

Hi,

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

Thanks,
Anthony


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

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.

Regards,
Ragamathullah B.


Mrudang Majmudar
Replied On August 25, 2011 01:11 PM

i have similar requirement for WPF DataGrid.

basically i want to do custom formatting
with CellType = UpDownEdit

e.g

Also how to control increment size
for up/down


Jawahar Jeevanandan J [Syncfusion]
Replied On August 29, 2011 10:27 AM

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.

Thanks,
Jawahar.



UpDownControl_56cecb45.zip

CONFIRMATION

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.

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.

;