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

GridGroupingControl - TableControl.Table.CurrentRecord bug?

Thread ID:





46542 Jul 14,2006 02:15 PM UTC Jul 19,2006 07:38 PM UTC WinForms 2
Tags: GridControl
Clive Hill
Asked On July 14, 2006 02:15 PM UTC

Hi, I handle two events for a GGC (different cells) - TableControlCurrentCellEditingComplete & TableControlCurrentCellCloseDropDown in both these handlers I use the following: TableControl.Table.CurrentRecord in the first case this is obtained via the EventArgs GridTableControlEventArgs e, and in the second case by using a reference to the GridGroupingControl obtained in the constructor of the class that handles these events. Intetmittently this reference is coming back as null, causing a null pointer when I try and do GetValue("ColName"). Has this behaviour been seen before? I can send through some of the code if this helps....

Administrator [Syncfusion]
Replied On July 17, 2006 05:01 PM UTC

>>TableControl.Table.CurrentRecord Where do you have this code when you get the null reference? Is it in someplace where there may not be a CurrentRecord set for that particular Table? (Are there nested tabbles involved?) If this code is located in a spot where there may not be a current record, then you should check null before trying to call GetValue. If you can post a sample showing the problem, we can try to give you more precise information on it.

Clive Hill
Replied On July 19, 2006 07:38 PM UTC

I''ve looked into this a bit more and the problem seems to occur under the following conditions:

-> click on a ComboBox, while the DropDown is still down (i.e. TableControlCurrentCellCloseDropDown has not triggerred), click on another cell. The error is always seen in this case. Following events are triggered: TableControlCurrentCellStartEditing, TableControlCurrentCellShowingDropDown, QueryCellStyleInfo, TableControlCurrentCellCloseDropDown, TableControlCurrentCellEditingComplete

-> clicking on an Editable cell, and then clicking on another cell. The error doesn''t always occur, but most of the time. Following events are triggered -> TableControlCurrentCellStartEditing, QueryStyleInfo (my code assigns valeus to e.Style properties), then TableControlCurrentCellEditingComplete where e.TableControl.Table.CurrentRecord is null.

From the above it seems that the null pointer is occurring in TableControlCurrentCellEditingComplete part of the code, where either the GridTextBoxCellRenderer is null (for ComboBox problem) or e.TableControl.Table.CurrentRecord is null (second scenario)

Here is the code snippet in TableControlCurrentCellEditingComplete handler:

private void _dataGrid_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)
_userIsEditing = false;
GridGroupingControl dataGrid = sender as GridGroupingControl;
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTextBoxCellRenderer gcrb = cc.Renderer as GridTextBoxCellRenderer;
// If the cell is ReadOnly do nothing
//bool isReadOnly = gcrb.IsReadOnly();
if(!(gcrb.ControlText == null || gcrb.ControlText == ""))
double updatedText = double.Parse(gcrb.ControlText);
GridTableCellStyleInfoIdentity style = dataGrid.TableModel[cc.RowIndex,cc.ColIndex].TableCellIdentity;
if(style.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellType == GridTableCellType.AlternateRecordFieldCell)
string mappingName = style.Column.Name;
string tenor = (string)e.TableControl.Table.CurrentRecord.GetValue("Tenor");

// blah blah

The error occurs where I would expect currentRecord to be set (i.e. clicking on a visible record on the grid), and no nested tables are involved.

I can open a Direct-Trac to post more of the code if required.


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