Hello,
I''m using your example EmployeeView. While Pressing Cursor left from FirstName I expect to get the fields Adress, next Region, next Title. But I got the order FirstName, LastName, Adress, City, PostalCode, Region and so on. How to get the expected order?
Regards Helmut
AD
Administrator
Syncfusion Team
July 21, 2006 07:23 AM UTC
Hi Helmut,
The simplest way to handle this is to subscribe to the TableControlCurrentCellKeyDown event and set the currentcell using the Record.SetCurrent method. Please refer the sample for more details.
private Hashtable traverseOrder = new Hashtable();
//form load.
traverseOrder.Add( "EmployeeID","Photo");
traverseOrder.Add( "Photo", "FirstName" );
private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e)
{
if(e.Inner.KeyCode == Keys.Right)
{
GridTableCellStyleInfo info = e.TableControl.CurrentCell.Renderer.CurrentStyle as GridTableCellStyleInfo;
if( info.TableCellIdentity.Column != null )
{
// traverseOrder having the column name and next column traverse name.
object column = traverseOrder[info.TableCellIdentity.Column.MappingName ] ;
if( column != null)
{
e.TableControl.Table.CurrentRecord.SetCurrent(column.ToString() );
}
}
e.Inner.Handled = true;
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/EmployeeView_bad96d7b.zip
Let me know if this helps.
Best Regards,
Haneef
Note : You need to change the connection string before run the sample.
HB
Helmut Basler
July 21, 2006 08:28 AM UTC
Hi Haneef,
this help .
Thanks
Helmut
HB
Helmut Basler
July 24, 2006 06:15 AM UTC
Hallo Haneef,
an additional Question for Cursor Up/down. To Process cursor up or down i''m searching for functions like "e.TableControl.Table.PreviewRecord.SetCurrent(column.ToString() );" and "e.TableControl.Table.NextRecord.SetCurrent(column.ToString() );" but i''m not able to find something.
Thanks again
Helmut
AD
Administrator
Syncfusion Team
July 24, 2006 09:05 AM UTC
Hi Helmut,
Could you try this code snippet to navigate the current record in a grid. Please find the code snippet below.
//for previous records.
int previndex = this.gridGroupingControl1.TableControl.CurrentCell.RowIndex - 1;
this.gridGroupingControl1.Table.DisplayElements[previndex].ParentRecord.SetCurrent();
//For next record.
int nextindex = this.gridGroupingControl1.TableControl.CurrentCell.RowIndex + 1;
this.gridGroupingControl1.Table.DisplayElements[nextindex].ParentRecord.SetCurrent();
Let me know if this helps.
Regards,
Haneef