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 have a grid grouping control that displays records under multiple groups. When I select one or more records under a group, collapse all the groups and try to retrieve the selected elements, using the property table.DisplayElements or table.Elements its throwing exception. How can I get the selected elements even when the groups are collapsed?
Here is the code segment I am using to retrieve selected records,
Table table = grid.Table;
foreach (GridRangeInfo range in grid.TableControl.Selections.Ranges) {
if (range.IsRows) {
for(int i = range.Top; i <= range.Bottom; ++i) {
Element el = table.DisplayElements[i];
Record r = el.GetRecord();
if (r!=null) {
object val = r.GetValue( "Column_Name" ) }
}
}
}
Regards,
Prathima.
ADAdministrator Syncfusion Team July 12, 2006 12:42 PM UTC
If you are using the support in GridGroupingControl for record selections (as opposed to using the selection support inherited from GridControlBase which has no knowlegde of the grouping architecture), then you access the selected records directly from the grid.Table.SelectRecords collection. Here is a little sample showing the 2 properties you need to set to activate the record selection support, and button handler code showing how to get at the selected records.
There is a little problem in that by default, these record selections are cleared when you click a +/- cell. If you do not want this, then you can handle a couple of events to avoid it. The sample does this.
http://www.syncfusion.com/Support/user/uploads/WindowsApplication17_25d9f93b.zip