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.
Basically I want to handle a key event in a gridgrouping control and do some stuff with the current selection. However I cant see where I can translate these row/col indexes to actual record indexes. See the following for where I''m code going with this:
private void TableControl_KeyDown(object sender, KeyEventArgs e)
{
if ( e.KeyCode == Keys.D && e.Modifiers == Keys.Control )
{
if ( gridGroupingControl1.TableControl.Selections.Count == 1 )
{
foreach ( GridRangeInfo info in gridGroupingControl1.TableControl.Selections.Ranges )
{
for ( int j=info.Left; j <= info.Right; j++ )
{
int fieldIndex = gridGroupingControl1.TableDescriptor.ColIndexToField(j);
for ( int i=info.Top; i <= info.Bottom; i++ )
{
//I''m looking for something like:
//int recordIndex = gridGroupingControl1.TableDescriptor.RowIndexToRecord(i);
//Record record = gridGroupingControl1.TableModel.Table.Records[recordIndex];
}
}
}
}
}
}
ADAdministrator Syncfusion Team July 22, 2004 01:30 PM UTC
Daniel,
there is a one-to-one relation between rowindex and the Table.DisplayElements collection.
If you have a rowIndex you can get the element that is displayed at that row with
Element el = Table.DisplayElements[rowIndex];
The record the element belongs to will be
Record r = el.ParentRecord;
The record position in the table can then be determined with
int index = Table.Records.IndexOf(r);
or the record position in the underlying source list with
int orginalIndex = Table.UnsortedRecords.IndexOf(r)
BTW - if you have an element and want to know the rowindex it is displayed at you can do this:
int rowIndex = Table.DisplayElements.IndexOf(el);
Stefan