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

Exception while updating databound grid

Thread ID:





67310 Aug 14,2007 12:45 AM UTC Aug 14,2007 06:49 AM UTC WinForms 1
Tags: GridControl
Shridhar Guravannavar
Asked On August 14, 2007 12:45 AM UTC


I am seeing following exception while updating databound grid. Please let me know what could be causing this issue.


************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.DataView.get_RowViewCache()
at System.Data.DataView.GetElement(Int32 index)
at System.Data.DataView.System.Collections.IList.get_Item(Int32 recordIndex)
at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.QueryCellInfo(GridQueryCellInfoEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Syncfusion.Windows.Forms.Grid.IGridModelDataProvider.QueryCellInfo(GridQueryCellInfoEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridModel.GetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style)
at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.GetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style)
at Syncfusion.Windows.Forms.Grid.GridVolatileData.get_Item(Int32 rowIndex, Int32 colIndex)
at Syncfusion.Windows.Forms.Grid.GridModel.get_Item(Int32 rowIndex, Int32 colIndex)
at Syncfusion.Windows.Forms.Grid.GridControlBase.GetViewStyleInfo(Int32 rowIndex, Int32 colIndex, Boolean forceQueryCellInfo)
at Syncfusion.Windows.Forms.Grid.GridControlBase.GetViewStyleInfo(Int32 rowIndex, Int32 colIndex)
at Syncfusion.Windows.Forms.Grid.GridControlBase.GetCellRenderer(Int32 rowIndex, Int32 colIndex)
at Syncfusion.Windows.Forms.Grid.SelectCellsHitTestInfo..ctor(GridControlBase grid, MouseEventArgs e, IMouseController controller)
at Syncfusion.Windows.Forms.Grid.GridSelectCellsMouseController.HitTest(MouseEventArgs e, IMouseController controller)
at Syncfusion.Windows.Forms.MouseControllerDispatcher.HitTest(Point point, MouseButtons mouseButton, Int32 clicks, IMouseController& controller)
at Syncfusion.Windows.Forms.MouseControllerDispatcher.ProcessMouseMove(MouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControllMouseControllerDispatcher.ScrollControlMouseMoveHandled(Object sender, MouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControl.OnScrollControlHandledMouseMove(MouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControl.OnMouseMove(MouseEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridControlBase.OnMouseMove(MouseEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridControlBaseImp.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Jeba S [Syncfusion]
Replied On August 14, 2007 06:49 AM UTC

Hi Shridhar,

Thank you for posting query to us.

Are you handling PrepareViewStyleInfo or Model.QueryCellInfo in the GridDataBoundGrid and trying to access anything from datatable directly?
For example if your datatable has row count = 5 and if e.RowIndex = 6 points to the 'AddNew' row in the grid (the empty row at the bottom), then there is no corresponding datarow in the datatable. So, you cannot try to access data from your datatable corresponding to this last row. If you do, you will get the message you mentioned. To prevent this, make sure e.RowIndex < gridDataBoundGrid1.Model.RowCount before you try to access any data directly from your datatable.You might try checking whenever you are trying to access data directly from the datasource.

Are you using multiple threads in your applications? If so please check this KB article http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=78. QueryCellInfo event is raised anytime something requires a grid value. So, if ever does grid[row,col] for any reason on a different thread, then there will be a problem.

Please refer this sample which implements the InvokeRequired check:

Are there any events handled while the ListChanged event is raised? The GridModelDataBinder listens of course to this event but are there are other listeners for other events that are triggered because of the ListChanged event, e.g. GridModelDataBinder.BindingListChanged?

private void Form1_Load(object sender, System.EventArgs e)
this.gridDataBoundGrid1.Binder.BindToCurrencyManager = false;
this.gridDataBoundGrid1.DataSource = dataTable;

Please refer to this KB for efficiently modifying the underlying data source. Here is the link to this KB.

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,


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