The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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....
ADAdministrator Syncfusion Team 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.
CHClive HillJuly 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
or -> 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.