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.

GridVisibleColumnDescriptorCollection.get_TotalWidth - Object Reference not set

Thread ID:

Created:

Updated:

Platform:

Replies:

15954 Jul 1,2004 04:31 AM Jul 2,2004 02:17 AM Windows Forms 1
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On July 1, 2004 04:31 AM

Hi, I have a grouping grid which occasionally raises an object reference not set exception and also occasioanly fails to draw the grid. I call a method that sets up the datasource and manually defines the columns to show based on parameters passed in. This a snapshot of the code: grid.SuspendLayout(); grid.DataSource = dataSource; grid.TableDescriptor.Columns.Clear(); grid.TableDescriptor.VisibleColumns.Clear(); grid.TableDescriptor.GroupedColumns.Clear(); grid.TableDescriptor.SortedColumns.Clear(); CreateDisplayColumns(); CreateGroupingColumns(); HideGroupingColumns(); AddSortByColumn(); grid.ResumeLayout(); CreateDisplayColumns does the following: It creates new GridColumnDescriptors and adds them to grid.TableDescriptor.Columns and grid.TableDescriptor.VisibleColumns for the columns the user wants to see. CreateGroupingColumns: Adds any required grouping cols to grid.TableDescriptor.GroupedColumns HideGroupingColumns: Simply sets colwidth to 0 for any grouping cols - this looks nicer AddSortByColumn: Adds a single sort by col to grid.TableDescriptor.SortedColumns if required. Is this the best approach for configuring the grid? Is there a better way in terms of performance? Would could be causing null reference exception. Thanks a lot Jason PS I''ve attached exception msg erortext_8085.zip

Administrator [Syncfusion]
Replied On July 2, 2004 02:17 AM

FYI using grid.TableModel.BeginUpdate(BeginUpdateOptions.Invalidate) and grid.TableModel.EndUpdate(true) Seem to make a lot of difference. The exceptions haven;t appeared since and the grid display is a lot quicker.

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.

;