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

Col Format in GridListControl

I need to change Col format in GridListControl to be that format "dd/MM/yyyy hh:mm tt" First my GridListControl have DataSource from DataTable and I have field DataTaype (DateTime) And result appear in grid like that ''01/01/2005'' but I need it to be like that ''01/01/2005 10:15 AM'' So now how can I change this column format? I''m trying to use this glstRemarks.Grid.ColStyles(4).Format = "dd/MM/yyyy hh:mm tt" But its return an error "Additional information: Specified argument was out of the range of valid values." So what can I use to change this column format?

3 Replies

AD Administrator Syncfusion Team April 6, 2005 09:28 AM UTC

You will not be able to do this using ColStyles. Instead, try handling the QueryCellInfo event on the embedded grid and handling things there.
 AddHandler GridListControl1.Grid.QueryCellInfo, AddressOf grid_QueryCellInfo

    Private Sub grid_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
        If e.ColIndex = 4 AndAlso e.RowIndex > 0 Then
            e.Style.Format = "dd/MM/yyyy hh:mm tt"
        End If
    End Sub

AY Ayman April 6, 2005 10:11 AM UTC

hi Clay, Every time i asked about anything u told me use QueryCellInfo so why all of that properties included in this controls in GridListControl and DataBound and GridDataBoundGrid. Just for show.

AD Administrator Syncfusion Team April 6, 2005 10:38 AM UTC

GridListControl.Grid and GridDataBoundGrid are both virtual grids. They do not really hold any data. Their datasource hold the data. This means they use QueryCellInfo to get at the data. If you want to change their behavior, then you also have to use QueryCellInfo, or else what you do will be stepped on by their QueryCellInfo work as it is completely dynamic. In some situations, the derived controls have specific properties to handle some things like GridBoundCOlumn,StyleInfo for a GridDataBoundGrid. But this only means the GridDataBoundGrid''s QueryCellInfo work is getting the information from these derived object properties.

Live Chat Icon For mobile
Up arrow icon