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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Header rows

Thread ID:





3936 Apr 19,2003 10:37 AM UTC Apr 19,2003 08:28 PM UTC WinForms 5
Tags: GridControl
Jeremy Holt
Asked On April 19, 2003 10:37 AM UTC

I'm using a GridDataBoundGrid. I would like to have two header rows - row(0) to be a covered cell, i.e. the Caption for the grid, and row(1) to be the column headers. The following code does not work Me.GridDataBoundGrid1.Model.Rows.HeaderCount = 1 Me.GridDataBoundGrid1.Model.Rows.FreezeRange(0, 1) Me.GridDataBoundGrid1.Model.CoveredRanges.Add(New GridRangeInfo().Row(0)) For i As Integer = 0 To Me.GridDataBoundGrid1.GridBoundColumns.Count - 1 Me.GridDataBoundGrid1.Model.Item(1, i).Text = Me.GridDataBoundGrid1.GridBoundColumns(i).HeaderText Next While I get the two header rows as I want, as soon as the grid fills with data, row(1) disappears. How do I get the grid to fill from row(2) onwards? Thanks Jeremy

Administrator [Syncfusion]
Replied On April 19, 2003 12:19 PM UTC

Here is code that works for me in version The idea is to hide the top header row which is where the grid tries to put its headers. Then add 2 new header rows. The GridDataBoundGrid should start populating under the last header row.
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        Me.GridDataBoundGrid1.Model.Data.RowCount = 2
        Me.GridDataBoundGrid1.Model.Rows.HeaderCount = 2
        Me.GridDataBoundGrid1.Model.Rows.FrozenCount = 2
        Me.GridDataBoundGrid1.Model.Rows.Hidden(0) = True
        Me.GridDataBoundGrid1.Model.CoveredRanges.Add(GridRangeInfo.Cells(1, 1, 1, Me.GridDataBoundGrid1.Model.ColCount))
        Dim i As Integer
        For i = 0 To Me.GridDataBoundGrid1.GridBoundColumns.Count - 1
            Me.GridDataBoundGrid1.Model.Item(2, i).Text = Me.GridDataBoundGrid1.GridBoundColumns(i).HeaderText

        Me.GridDataBoundGrid1.Model.Item(1, 1).Text = "Big Title"
    End Sub

Jeremy Holt
Replied On April 19, 2003 12:52 PM UTC

Clay - it works, but you can not set the column widths at run time. I think I'll just embed the grid in a panel with a label on top Thanks Jeremy

Administrator [Syncfusion]
Replied On April 19, 2003 01:08 PM UTC

You should be able to set colwidths at runtime. Make sure gridDataBoundGrid1.AllowResizeToFit is set to false. Then to change the with of column 4, use code like gridDataBoundGrid.Model.ColWidths(4) = 200

Jeremy Holt
Replied On April 19, 2003 06:51 PM UTC

I meant to say that you can't drag the column with the mouse.

Administrator [Syncfusion]
Replied On April 19, 2003 08:28 PM UTC

If you want to support dragging columns, then using a panel with a label as you suggested would be a simpler way to go.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon