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.

Problem with VirtTreeGrid sample

Thread ID:

Created:

Updated:

Platform:

Replies:

34603 Sep 13,2005 10:44 AM Sep 15,2005 07:43 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 13, 2005 10:44 AM

I''m trying to extend this sample so that I can programmatically set the column headers after loading the data. I''ve tried: Me.gridControl1(0, 3).Text = "12345" Me.gridControl1(1, 3).Text = "54321" but only cell(1,3) gets updated. Any ideas why the column headers aren''t being updated. Thanks Akash

Administrator [Syncfusion]
Replied On September 13, 2005 11:08 AM

Another problem: I can''t resize the column widths at runtime. Is there some grid property that must be set to allow this?

Administrator [Syncfusion]
Replied On September 14, 2005 10:15 AM

I put your code in a button handler and it worked OK for me on the click of the button. Both values were set. You should set to see if you have somehow set a ReadOnly style property on the header cell. That would prevent your code from working. The ResizeColsBehavior property is how control whether your user can resize the colwidths. Make sure you do not have this set to none.

Administrator [Syncfusion]
Replied On September 14, 2005 10:19 AM

I am sorry. I do see the problem in the VirtTree sample with the header not being set. I will update this when I have more informastion.

Administrator [Syncfusion]
Replied On September 14, 2005 10:26 AM

To set the headers, you can add code to QueryCellInfo an dset them there.
Private Sub GridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)

            If e.RowIndex = 0 And e.ColIndex > 0 Then
                e.Style.Text = String.Format("col{0}", e.ColIndex)
            ElseIf ((e.RowIndex > 0) _
                        AndAlso (e.ColIndex > 0)) Then
                e.Style.CellValue = externalData((e.RowIndex - 1)).Items((e.ColIndex - 1))
                If (e.ColIndex = 1) Then
                    e.Style.CellType = "TreeCell"
                    e.Style.Tag = externalData((e.RowIndex - 1)).IndentLevel
                    e.Style.ImageIndex = CType(externalData((e.RowIndex - 1)).ExpandState, Integer)
                End If
                e.Handled = True
            End If

        End Sub
The reason you cannot size the columns is that the columns widths are being set in the QueryColWidth event. You would have to remove that event to allow for teh default sizing to take place, or you would have to change the handler to size things in the event.

Administrator [Syncfusion]
Replied On September 15, 2005 07:43 AM

Thanks Clay, Both your fixes work as expected. Akash

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.

;