Hello!
In hope the question is not already solved and I understand your problem, here my recommendation:
Using the HTML Agility Pack is a good idea, it is almost like the Microsoft XmlDocument but supports html (i.e. it does not crash if the html is malformed).
The solution to your problem might be XPath
(here is a really good tutorial) - with a single XPath-expression you can enumerate through all your elements which have an id:
HtmlDocument hd = new HtmlDocument();
foreach (var node in hd.DocumentNode.SelectNodes("//input[@id]"))
{
}