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

Number Format in DataBoundGrid

Clay, I have set format like "#,###.00(#,###.00)" for one my number column. If the user enters the say -10000, and moves to the another cell. the value -10000 will be displayed like (10,000). Now if user wants to edit that cell again, i want the value in the cell should be displayed like the one user entered i.e. -10000 not the formatted one (10,000) So how to achieve this? Thanks Satish

1 Reply

AD Administrator Syncfusion Team July 28, 2004 05:59 AM UTC

You can handle the CurrentCellInitializeControlText event and do it there.
Private Sub gridControl1_CurrentCellInitializeControlText(ByVal sender As Object, ByVal e As GridCurrentCellInitializeControlTextEventArgs)
     If e.RowIndex = 1 And e.ColIndex = 1 Then
          Dim d As Double = e.CellValue
          If d < 0 Then
              e.ControlText = d.ToString()
          End If
      End If
End Sub

Live Chat Icon For mobile
Up arrow icon