I have this query to collection:
Panel thePanel = menuCell.Controls.OfType<Panel>()
.Where(panel => panel.Controls.OfType<HyperLink>().Any(
label => label.ID == clas))
.FirstOrDefault();
This gets only the Panel that has an hyperlink with a certain id. I need to get not only the firstOrDefault but the matched element (only the first) and the 2 next within the sequence. I didn’t try anything because don’t know how.
This will return first three panels, which have hyperlinks with a certain id
If you need first panel which have hyperlinks with a certain id, and next two panels whatever they have: