Find a particular row from grid view using LINQ
This code segment explain you, how to find a particular row from grid view using LINQ
Usually getting a row from a Grid view, we will loop thru the grid view row collection and check for conditions as shown below.
GridViewRow SelectedRow;
foreach (GridViewRow gr in GridView1.Rows)
{
if ( gr.Cells[1].ToString() == "Value1" && gr.Cells[2].ToString() == "Value2")
{
SelectedRow = gr;
break;
}
}
But we can write same logic as more readable manner in LINQ as shown below.
GridViewRow SelectedRow = GridView1.Rows.OfType
Link : http://www.dotnetspark.com/kb/2735-find-out-particular-row-form-grid-view-using.aspx
The type returned by the Linq Query is mostly a collection or anonymous type specified by the keyword var or dim.Hope your assignment is not correct.