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.
Is it possible to iterate through all the cells of the grid with a foreach loop? If not, is there a recommended alternative process to do when we want to iterate through all the cells?
ADAdministrator Syncfusion Team June 26, 2006 05:37 PM UTC
Hi Jesse,
No, It is not possible to iterate through all the cells of the grid with a foreach loop. You can use this code to iterate all the cells in a grid. Here is a code snippet.
for(int i = 0 ;i <= this.grid.Model.RowCount;i++)
{
for(int j=0;j< this.grid.Model.Colcount;j++)
{
//To acess the cell using this code.
Console.WriteLine (this.grid.Model[i,j].Text);
}
}
Let me know if this helps.
Best Regards,
Haneef
JMJesse MarekJune 26, 2006 07:12 PM UTC
Thanks. The code works great. (It''s a <= in both for loops, though.)
>Hi Jesse,
>
>No, It is not possible to iterate through all the cells of the grid with a foreach loop. You can use this code to iterate all the cells in a grid. Here is a code snippet.
>
>for(int i = 0 ;i <= this.grid.Model.RowCount;i++)
>{
> for(int j=0;j< this.grid.Model.Colcount;j++)
> {
> //To acess the cell using this code.
> Console.WriteLine (this.grid.Model[i,j].Text);
> }
>}
>
>Let me know if this helps.
>Best Regards,
>Haneef