I have a ggc that is group by one level.
When I navigative using the ARROW keys or click on a cell using the mouse, I need to determine the current record and the columnname that I am on.
I need to ignore cases where the user click on the plus/minus button, the header cell, or the summarysection.
The only sections that I am interested in is the grid record riow and the caption section row.
AD
Administrator
Syncfusion Team
December 11, 2006 04:57 AM UTC
Hi James,
You can get the current record and current column details from currentcell using the following code.
GridCurrentCell cc = Grid.TableControl.CurrentCell;
//Get the TableCellStyleInfo from GridStyleInfo object
GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo;
if( style != null && style.TableCellIdentity.Column != null)
{
Element eDisplayElement = style.TableCellIdentity.DisplayElement;
if( eDisplayElement.Kind == DisplayElementKind.Record && eDisplayElement.ParentTable != null )
{
Console.WriteLine("Current Record:" + eDisplayElement.ParentTable.CurrentRecord);
Console.WriteLine("Current ColumnName: " + style.TableCellIdentity.Column.Name);
}
}
Best Regards,
Haneef
JB
James Blibo
December 11, 2006 04:57 PM UTC
Which event do I subscribe to get this? I want this value as soon at the a cell GETS FOCUS.
AD
Administrator
Syncfusion Team
December 12, 2006 04:35 AM UTC
Hi James,
You can handle the TableControlCellClick event and access the current cell details. Please try the attached sample and let me know if you are looking something different.
GGCCurrentRecordDetails.zipBest Regards,
Haneef
JB
James Blibo
December 12, 2006 12:21 PM UTC
This works fine when the user uses the mouse to click in the cell. However, when the you use the arrow key to navigate to the next cell, the event is NOT raised.
I need to determine the current cell for both when a cell receives focus, for both situations!
AD
Administrator
Syncfusion Team
December 13, 2006 06:48 AM UTC
Hi James,
Please try using the TableControlCurrentCellActivated event. This event will be triggered for both the Mouse click and navigation through keys. The following is the code snippet
>>>>>>
//this.gridGroupingControl1.TableControlCurrentCellActivated +=new GridTableControlEventHandler(gridGroupingControl1_TableControlCurrentCellActivated);
private void gridGroupingControl1_TableControlCurrentCellActivated(object sender, GridTableControlEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex,cc.ColIndex] as GridTableCellStyleInfo;
if( style != null && style.TableCellIdentity.Column != null)
{
Element eDisplayElement = style.TableCellIdentity.DisplayElement;
if( eDisplayElement.Kind == DisplayElementKind.Record && eDisplayElement.ParentTable != null )
{
Console.WriteLine("Current Record:" + eDisplayElement.ParentTable.CurrentRecord);
Console.WriteLine("Current ColumnName: " + style.TableCellIdentity.Column.Name);
}
}
}
>>>>>>
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
AD
Administrator
Syncfusion Team
August 18, 2008 05:11 PM UTC
Say, I have saved the CurrentCell, and before completing some processing tried to navigate to another row and even in a different level.
How would I cancel the move to the new Row?
How would I go back to the original cell/row programatically?
>Hi James,
You can get the current record and current column details from currentcell using the following code.
GridCurrentCell cc = Grid.TableControl.CurrentCell;
//Get the TableCellStyleInfo from GridStyleInfo object
GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo;
if( style != null && style.TableCellIdentity.Column != null)
{
Element eDisplayElement = style.TableCellIdentity.DisplayElement;
if( eDisplayElement.Kind == DisplayElementKind.Record && eDisplayElement.ParentTable != null )
{
Console.WriteLine("Current Record:" + eDisplayElement.ParentTable.CurrentRecord);
Console.WriteLine("Current ColumnName: " + style.TableCellIdentity.Column.Name);
}
}
Best Regards,
Haneef
SR
Sri Rajan
Syncfusion Team
August 19, 2008 12:55 PM UTC
Hi Aaron,
Thank you for your interest in Syncfusion products.
You can use CurrentCell.MoveTo method to move to any cell programatically. You can retain the focus in the current cell by specifying the current row, column index in the MoveTo, so that you can avoid moving to any row until process is completed.
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(GridRangeInfo.Cell(4, 1));
Please let me know if this helps.
Best Regards,
Srirajan.