Search code examples
c#devexpressgridlookupedit

How can I hide zeros in GridLookUpEdit?


I got form with GridLookUpEdit. DisplayMember type is DateTime. So I set GridLookUpEdit FormatType to DateTime and FormatString to "d". But when I select row in GridLookUpEdit, selected value is displayed with zero-time, like 15.04.2014 0:00:00. How can I avoid this thing?


Solution

  • When you select a particular cell and if the cell is set to Editable then the cell's editor is shown. To use a particular cell editor, you have to add these lines of code :

    // aDateColumn is the column you want to format
    // Custom mask
    RepositoryItemTextEdit columnEdit = new RepositoryItemTextEdit();
    columnEdit.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
    columnEdit.Mask.EditMask = "d";
    
    aDateColumn.ColumnEdit = columnEdit;
    

    More info here.