In Ultragrid, we have applying editor at column level,. In ediotr we are dividing the value by units like 10, 100, 1000, 1000000 in method Presenter.GetDisplayUnitValue().
We are able to see the correct result in the grid but while printing units are getting lost, only formatting is there . For example In grid it is showing 3,574 but in printing it is showing 3,574, 117,511. It should display the same result.Below is the code snippet
IntializeLayout()
column.Editor.DataFilter = new UnitEditorDataFilter() { Presenter = m_presenter };
column.Format = "#,###;-#,###"
Editor Code:
public class UnitEditorDataFilter : IEditorDataFilter
object IEditorDataFilter.Convert(Infragistics.Win.EditorDataFilterConvertArgs args)
{
double d;
UltraGridCell cell = args.Context as UltraGridCell;
if (double.TryParse(args.Value.ToString(), out d) && cell.Column.Header.Caption.Contains('/'))
switch (args.Direction)
case ConversionDirection.EditorToDisplay:
args.Handled = true;
if (args.Value.ToString() == "0")
return string.Empty;
else
return (System.Math.Floor(System.Convert.ToDouble(args.Value) / Presenter.GetDisplayUnitValue())).ToString("#,###;-#,###");
case ConversionDirection.DisplayToEditor:
return (System.Convert.ToDouble(args.Value) * Presenter.GetDisplayUnitValue()).ToString();
}}}
Print Code: we are using
PrintDocument pd.print (gridname)
Thanks