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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with VirtTreeGrid sample

Thread ID:





34603 Sep 13,2005 02:44 PM UTC Sep 15,2005 11:43 AM UTC WinForms 5
Tags: GridControl
Administrator [Syncfusion]
Asked On September 13, 2005 02:44 PM UTC

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 03:08 PM UTC

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 02:15 PM UTC

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 02:19 PM UTC

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 02:26 PM UTC

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 11:43 AM UTC

Thanks Clay, Both your fixes work as expected. Akash


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