Click here to Skip to main content
15,881,248 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionASP .NET list of text boxes not aligning properly Pin
Member 1462055328-Dec-19 16:23
Member 1462055328-Dec-19 16:23 
AnswerRe: ASP .NET list of text boxes not aligning properly Pin
Member 1462055329-Dec-19 1:38
Member 1462055329-Dec-19 1:38 
QuestionASP.Net MVC: How to print raw model in razor view Pin
Mou_kol24-Dec-19 22:19
Mou_kol24-Dec-19 22:19 
AnswerRe: ASP.Net MVC: How to print raw model in razor view Pin
F-ES Sitecore25-Dec-19 9:17
professionalF-ES Sitecore25-Dec-19 9:17 
QuestionallowDefinition='MachineToApplication' beyond application level Pin
kuldeeps2117-Dec-19 4:53
kuldeeps2117-Dec-19 4:53 
AnswerRe: allowDefinition='MachineToApplication' beyond application level Pin
Richard Deeming17-Dec-19 5:07
mveRichard Deeming17-Dec-19 5:07 
QuestionScrape with htmlagilitypack problems Pin
Member 175325016-Dec-19 6:02
Member 175325016-Dec-19 6:02 
AnswerRe: Scrape with htmlagilitypack problems Pin
Richard Deeming16-Dec-19 8:41
mveRichard Deeming16-Dec-19 8:41 
Member 1753250 wrote:
VB.NET
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("th")
You're iterating over all <th> nodes which are direct descendants of the document. There probably aren't any.

Instead, based on the comments, you probably want to iterate over the <tr> nodes which are direct descendants of the <table>:
VB.NET
Dim rows As HtmlAgilityPack.HtmlNodeCollection = tables(0).SelectNodes("tr")
However, this will depend on the markup. The rows might not be direct descendants of the <table>; they could be nested in one or more <thead>, <tbody>, or <tfoot> elements.

When you query for cells, you're also only looking for <th> elements. You're skipping ordinary <td> elements.

If you don't have to worry about nested tables, you could try:
VB.NET
Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//table[@id='workorders']//tr")
For i As Integer = 0 To rows.Count - 1
    Dim cols As HtmlAgilityPack.HtmlNodeCollection = rows(i).SelectNodes("th|td")
    ...
Next




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Scrape with htmlagilitypack problems Pin
Member 175325018-Dec-19 11:22
Member 175325018-Dec-19 11:22 
QuestionASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Mou_kol15-Dec-19 9:33
Mou_kol15-Dec-19 9:33 
AnswerRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Richard Deeming16-Dec-19 8:30
mveRichard Deeming16-Dec-19 8:30 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Mou_kol24-Dec-19 21:14
Mou_kol24-Dec-19 21:14 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Richard Deeming7-Jan-20 8:09
mveRichard Deeming7-Jan-20 8:09 
QuestionHow do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 21:39
Marc Hede12-Dec-19 21:39 
AnswerRe: How do I change this code using Inheritance? Pin
Richard MacCutchan12-Dec-19 22:15
mveRichard MacCutchan12-Dec-19 22:15 
AnswerRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 22:23
professionalphil.o12-Dec-19 22:23 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 22:57
Marc Hede12-Dec-19 22:57 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 23:26
professionalphil.o12-Dec-19 23:26 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 23:49
Marc Hede12-Dec-19 23:49 
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore12-Dec-19 23:59
professionalF-ES Sitecore12-Dec-19 23:59 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 0:17
Marc Hede13-Dec-19 0:17 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o13-Dec-19 0:52
professionalphil.o13-Dec-19 0:52 
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore13-Dec-19 0:54
professionalF-ES Sitecore13-Dec-19 0:54 
GeneralRe: How do I change this code using Inheritance? Pin
Richard Deeming13-Dec-19 0:58
mveRichard Deeming13-Dec-19 0:58 
GeneralRe: How do I change this code using Inheritance? Pin
Richard MacCutchan13-Dec-19 0:00
mveRichard MacCutchan13-Dec-19 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.