Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to programmatically format a column

Sort Posts: Previous Next
  •  02-23-2012, 2:04 PM Post no. 31727

    How to programmatically format a column

    Assuming the grid is bound to a database and, of course, BEFORE the connection is opened, how to format a column, For instance phone numbers are stored as digits only and I want to display with a mask. I don't want the grid to compute and transform each cell after the display, I want the display to take into account the formatting.

  •  02-24-2012, 10:09 AM Post no. 31735 in reply to 31727

    Re: How to programmatically format a column

    Hi Frederic, 

    You could use the GridMaskTextBox to provide amask. You can do something as follows : 

    Xceed.Grid.Editors.GridMaskedTextBox maskEditor = new Xceed.Grid.Editors.GridMaskedTextBox();
    Xceed.Grid.Editors.GridMaskedTextBox maskViewer = new Xceed.Grid.Editors.GridMaskedTextBox();

    gridControl1.Columns[ 0 ].CellEditor = maskEditor;
    gridControl1.Columns[ 0 ].CellViewer = maskViewer;

    maskEditor.Mask = "###-###-###";

    maskViewer.Mask = "###-###-###"; 


    Best Regards,

    Michel Dahdah
    Technical Support
    Xceed Software inc.
  •  02-24-2012, 2:35 PM Post no. 31741 in reply to 31735

    Re: How to programmatically format a column

    I also found the following way:

    gridControl1.Columns[<column name>].FormatSpecifier = "###-###-###";

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.