Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
440
WinGrid and individual cell formatting
posted

I know there are a number of posts already on this, but I've been through them all and am going round in circles. I have a datagrid, with a numeric column and a hidden string column that contains a format I want to apply to each cell of the numeric column. I have a handler executing on the InitializeRow event of the datagrid, with the following code ...

Private Sub DataGridInitializeRowHandler _
    (ByVal sender As Object, _
      ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs)

  Dim band As UltraGridBand = DataGrid.DisplayLayout.Bands(0)
  Dim ColumnName as String = GetColumnName
  Dim Format As String = e.Row.GetCellText(band.Columns("Format"))
  Dim editor As Infragistics.Win.EmbeddableEditorBase = EditorCache.GetEditor(Format)

  e.Row.Cells(SummaryColumn.ColumnName).Editor = editor
   
End Sub

My Format variable is being successfully populated with values such as {0:$#,##0.00} and {0:##.##%}, the editor EmbeddableEditorBase object is correctly created and assigned, but the format of the objects in the grid never changes.

Any pointers as to what I'm missing or doing wrong would be very much appreciated.

Thanks
Nick

Parents
No Data
Reply
  • 440
    Verified Answer
    posted

    OK, solved this myself if anyone esle comes across a similar issue. Elsewhere in my code I wassetting the column format property. If I removed this line it works.

    DataGrid.DisplayLayout.Bands(0).Columns(ColumnName).Format = sFormat

    One other small point, the format string shouldn't include the type specification. Needed to change mine to be $#,##0.00 and ##.##%

Children