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.
I am using GridControl 4.402.0.55. I have approx 25 rows in first place and I am allowing user to select some rows(subject to some conditions), However I am not able to get the selected rows data in a seperate collection.
What is the simplest way I can get the selected rows details without iteration in whole data and can store in Custom Entity Collection?
HAhaneefm Syncfusion Team March 30, 2007 02:21 PM UTC
Hi Nhilesh,
Use GetSelectedRows method from the GridModelSelections to get the selected rows in the grid. It returns the GridRangeInfoList with row ranges. It takes two parameters.
bRangeRowsOnly -True if only selected rows should be returned; False if you want to treat single range cell selections as full row selections. considerCurrentCell - True if current cell should be returned as selected range if there are no other selected ranges.
[c#]
foreach (GridRangeInfo r in this.gridDataBoundGrid1.Model.Selections.GetSelectedRows(true, true)) { Console.WrtieLine( "RangeInfo:" + r.Info); }
Best regards, Haneef
NBNhilesh BauaApril 2, 2007 05:49 AM UTC
Hi Haneef,
I did almost same thing b4, This is my code shown as under:
//Loop through Range Information and prompt foreach (GridRangeInfo grRangeInfo in grInfoList) { if (grRangeInfo.IsRows) { MessageBox.Show(grRangeInfo.Info.ToString()); } } /***********************************************/
However I always get MessageBox showing only "Rn" where n is the number of that row and this is the value of the row headers.
I want the complete row data for all the cells along with the row identifer.
Can you please show me how to do it? Thanks in advance and thanks for PASTEing the code.
Regards, Nhilesh Baua.
HAhaneefm Syncfusion Team April 3, 2007 02:52 AM UTC
Hi Nhilesh,
Use the Table.DisplayElements property of the grid to find the corresponding record in a grid. Here is a code snippet that shows you "How to access a record from the rowindex in a grid?"
foreach (GridRangeInfo grRangeInfo in grInfoList) { if (grRangeInfo.IsRows) { string strRowInfo = string.Empty; for(int i = grRangeInfo.Top;i<=grRangeInfo.Bottom;i++) { // using the displayelements property of the grid, we can find the corresponding record. Record r = gridGroupingControl1.Table.DisplayElements[i].ParentRecord; if( r != null) { strRowInfo += string.Format("{0}===>{1}",i r.Info) + Environment.NewLine; } } MessageBox.Show(strRowInfo); } }