I use WinForms DataGridView in Virtual mode based on MSDN samples.
Grid data is cached in paged List
Data is retrieved in OnCellValueNeeded() event
using DLinq Skip()/Take() methods from server database.
I have implemented column search feature which allows to locate row whose
column contain sertain value.
I use DataGridView method for it:void LocateInColumn() {
SearchFor = Microsoft.VisualBasic.Interaction.InputBox(
Columns[CurrentCell.ColumnIndex].HeaderText,
"Locate value",
"", -1, -1);
int col = CurrentCell.ColumnIndex;
for (int i = CurrentRow.Index + 1; i < RowCount - 1; i++) {
object val = this[col, i].Value;
if (val == null) continue;
if (val.ToString().ToUpper().
Contains(SearchFor.ToUpper())) {
CurrentCell = this[col, i];
return;
}
}
MessageBox.Show("Not found");
}
This code causes all data to be readed over internet connection and is very slow.
I cannot use Where clause directly since I need to show also rows before and next located row.
How to locate row without reading whole database ?
I can use where clause to find row id. However I have no idea how to position virutal grid to this row
so that rows before and after are also visible.
Is it possible to implement in easily in some other GUI: GTK#, Silverlight, WPF ?
Are there any grid control available which implements this ?
Andrus