We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

looping through a databoundgrid

Hi,
I was wondering if anyone knows how to loop through a datagrid and find out the rows that have been selected.

1 Reply

AD Administrator Syncfusion Team September 6, 2006 04:20 AM UTC

Hi Charlie,

If you want to implement a find functionality in the grid, refer the below forum thread for more details.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=45839

If you want to find a selected rows in the grid, use the Model.Selection property.The Model.Selections property manages the range selection in a grid. Below is a code snippet.

Console.WriteLine("Selected Ranges");
foreach( GridRangeInfo range in this.gridDataBoundGrid1.Model.Selections.Ranges)
{
Console.WriteLine(range.Info);
}

To loop through the grid, you can use the Model Property of the grid. Below is a code snippet.

for(int i = 0;i<= this.grid.Model.RowCount;i++)
{
for(int j = 0;j<= this.grid.Model.ColCount;j++)
Console.WriteLine("=>" + this.grid.Model[i,j]);
Console.WriteLine(" ");
}

Let me know if this helps.
Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon