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

GridVisibleColumnDescriptorCollection.get_TotalWidth - Object Reference not set

Thread ID:





15954 Jul 1,2004 08:31 AM UTC Jul 2,2004 06:17 AM UTC WinForms 1
Tags: Grouping
Administrator [Syncfusion]
Asked On July 1, 2004 08:31 AM UTC

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 06:17 AM UTC

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.


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