Parsing HTML Table in C#
c#, html-agility-pack, html-table, parsing
Solution
Using Html Agility Pack
WebClient webClient = new WebClient();
string page = webClient.DownloadString("http://www.mufap.com.pk/payout-report.php?tab=01");
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(page);
List<List<string>> table = doc.DocumentNode.SelectSingleNode("//table[@class='mydata']")
.Descendants("tr")
.Skip(1)
.Where(tr=>tr.Elements("td").Count()>1)
.Select(tr => tr.Elements("td").Select(td => td.InnerText.Trim()).ToList())
.ToList();
Problem
I have an html page which contains a table and i want to parse that table in C# windows form http://www.mufap.com.pk/payout-report.php?tab=01 this is the webpage i want to parse i have tried ``` > Foreach(Htmlnode a in document.getelementbyname("tr")) { richtextbox1.text=a.innertext; } ``` i have tried some thing like this but it wont give me in tabular form as i am simply printing all trs so please help me regarding this thanx sorry for my english.