Yusril Maulidan Raji Yusril Maulidan Raji - 1 year ago 75
HTML Question

How to select td inside tfoot with HtmlAgilityPack?

I have this html:


I tried to get the
of the
, but I have problem with it.
Here is what I have tried:

var mainGrid = htmlDoc.DocumentNode.SelectSingleNode("//table");
var footerGrid = mainGrid.SelectSingleNode("//tfoot");
var tdFooterGrid = footerGrid.SelectSingleNode("//td");
if (tdFooterGrid != null)
var a = tdFooterGrid.InnerHtml;

That was fine until I retrieved the
. When I continued to get the
in order to get the
text, it resulted the
Body 1

Is there any suggestion for this?

Answer Source

Below Code will work if you want values inside footer td tag.

var footerGrid = htmlDoc.DocumentNode.SelectSingleNode("//tfoot//td");
if (footerGrid != null)
            var a = footerGrid.InnerText;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download