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. Image for the cookie policy date

Formatting Fractions

I am using the GridControl and showing fractions within cells. I use the QueryCellValue callback for performance reasons. Is it possible to show fractions with a format of one number ontop of the other like:


1
---
2

Instead of 1/2




1 Reply

MW Melba Winshia Syncfusion Team September 16, 2009 12:21 PM UTC

Hi,

Thank you for your interest in Syncfusion Products.

Yes. You can use below code snippet to show fractions with a format of one number on top:




protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType ==

GridTableCellType.AlternateRecordFieldCell)
{

if(e.TableCellIdentity.Column.Name=="SNo")
{
string s = e.Style.CellValue.ToString();
string[] split = s.Split(new char[] { '/' });
e.Style.CellValue= split[0]+"
---

}

}
}



Please try this and let me know if this helps.

Thanks,
Melba


Loader.
Live Chat Icon For mobile
Up arrow icon