0

I have a webmethod like,

public List<List<string>> HelloWorld() {

    WebClient webClient = new WebClient();
    string page = webClient.DownloadString("http://www.deu.edu.tr/DEUWeb/Guncel/v2_index_cron.html");

    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    doc.LoadHtml(page);

        List<List<string>> table = doc.DocumentNode.SelectSingleNode("//table")
        .Descendants("tr")
        .Skip(1)
        .Select(tr => tr.Elements("td").Select(td => td.InnerText.Trim()).ToList())
        .ToList();

    return table;
}

I've got the information inside the table but I want to get also <a href="Link"> link information of the table.

What should I add to the method? I need both information at the same time.

HTML

<table>
   <tr>
     <td>
        <img/>
     </td>
     <td>
        <a href="what I want">Text</a>
     </td>
   </tr>
    .....
</table>
Liam
  • 27,717
  • 28
  • 128
  • 190
OykunYenal
  • 85
  • 4
  • 14

1 Answers1

0

You can use jQuery, something like this:

<a href="https://google.com" class="demo">Click me</a>
<script>
alert($('.demo').attr('href'));
</script>