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

Header rows

Thread ID:

Created:

Updated:

Platform:

Replies:

3936 Apr 19,2003 06:37 AM Apr 19,2003 04:28 PM Windows Forms 5
loading
Tags: GridControl
Jeremy Holt
Asked On April 19, 2003 06:37 AM

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 08:19 AM

Here is code that works for me in version 1.5.2.0. 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.SqlDataAdapter1.Fill(Me.DataSet11)

        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
        Next

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

Jeremy Holt
Replied On April 19, 2003 08:52 AM

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 09:08 AM

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 02:51 PM

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

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

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

CONFIRMATION

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.

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.

;