Reputation: 11
I want to iterate through HtmlTable (Server Side) in ASP.NET 3.5.
foreach (System.Web.UI.HtmlControls.HtmlTableRow trow in someTable)
{
var x = trow.InnerText;
}
I received an error message that "System.Web.UI.HtmlControls.HtmlTable"
does not contain a definition for GetEnumerator.
How to write an extension method or alternative to make HtmlTable as enumerable row collection?
Thanks.
Upvotes: 0
Views: 623
Reputation: 25652
Are you going for something more like this?
foreach (HtmlTableRow trow in someTable.Rows)
{
foreach (HtmlTableCell cell in trow.Cells)
{
// ...
}
}
Upvotes: 1