|
Sorry didn't mean to be rude. Was trying to thank someone for their help and inspiration. And didn't want to have a huge long lasting thing so figured posting in a forum would be good, so that it was ephemeral. For some reason I can't seem to delete to post. If you can, please do so.
|
|
|
|
|
If you want to thank someone, reply to a comment they made, or post at the bottom of the article. That way they should notice it*
Why would you want your work to be ephemeral, if you are sharing it anyway?
You can't delete your post because it has a reply - that would "orphan" the response(s) and lose the meaning of the thread (obvious if you think about it). Yes I can delete the whole thread (all Protectors can) but it's not necessary it's only "slightly rude" not "you b*****d" rude! I wouldn't worry about it, but if you still want that, just say the word.
* Some people run with emails disabled, or deliberately use a dummy email so "@" messages may not get through at all.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Since the license makes it free you can post in the Free Tools forum.
|
|
|
|
|
I want to parse multiple html table using htmlagility pack. i want to iterate in all TD and extract values.
please have a look at this url https:
the above url has many tabular data whose html tables i have to parse.
here i am pasting a small snippet of html table. please check how data is stored in this table.
<pre><table style="border-collapse:collapse;display:inline-table;margin-bottom:5pt;vertical-align:text-bottom;width:99.853%"> <tbody> <tr> <td style="width:1.0%"></td> <td style="width:71.960%"></td> <td style="width:0.1%"></td> <td style="width:0.1%"></td> <td style="width:0.532%"></td> <td style="width:0.1%"></td> <td style="width:1.0%"></td> <td style="width:11.637%"></td> <td style="width:0.1%"></td> <td style="width:0.1%"></td> <td style="width:0.532%"></td> <td style="width:0.1%"></td> <td style="width:1.0%"></td> <td style="width:11.639%"></td> <td style="width:0.1%"></td> </tr> <tr style="height:12pt"> <td colspan="3" style="padding:2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:1pt;font-weight:700;line-height:100%"> </span></td> <td colspan="3" style="padding:0 1pt"></td> <td colspan="3" rowspan="2" style="padding:2px 1pt;text-align:center;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:8pt;font-weight:700;line-height:100%">June 30,<br>2023</span></td> <td colspan="3" style="padding:0 1pt"></td> <td colspan="3" rowspan="2" style="padding:2px 1pt;text-align:center;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:8pt;font-weight:700;line-height:100%">December 31,<br>2022</span></td> </tr> <tr style="height:12pt"> <td colspan="3" style="padding:2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:8pt;font-weight:700;line-height:100%">(In thousands, except share data)</span></td> <td colspan="3" style="padding:0 1pt"></td> <td colspan="3" style="padding:0 1pt"></td> </tr> <tr> <td colspan="3" style="background-color:#cceeff;border-top:1pt solid #000000;padding:2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:700;line-height:100%">Assets</span></td> <td colspan="3" style="background-color:#cceeff;padding:0 1pt"></td> <td colspan="3" style="background-color:#cceeff;border-top:1pt solid #000000;padding:2px 1pt;text-align:right;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:1pt;font-weight:700;line-height:100%"> </span></td> <td colspan="3" style="background-color:#cceeff;padding:0 1pt"></td> <td colspan="3" style="background-color:#cceeff;border-top:1pt solid #000000;padding:2px 1pt;text-align:right;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:1pt;font-weight:400;line-height:100%"> </span></td> </tr> <tr> <td colspan="3" style="background-color:#ffffff;padding:2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:400;line-height:100%">Cash and due from banks</span></td> <td colspan="3" style="background-color:#ffffff;padding:0 1pt"></td> <td style="background-color:#ffffff;padding:2px 0 2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:400;line-height:100%">$</span></td> <td style="background-color:#ffffff;padding:2px 0;text-align:right;vertical-align:bottom"> <span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:400;line-height:100%"> <ix:nonfraction unitref="usd" contextref="c-3" decimals="-3" name="us-gaap:CashAndDueFromBanks" format="ixt:num-dot-decimal" scale="3" id="f-32">120,285</ix:nonfraction> </span> </td> <td style="background-color:#ffffff;padding:2px 1pt 2px 0;text-align:right;vertical-align:bottom"></td> <td colspan="3" style="background-color:#ffffff;padding:0 1pt"></td> <td style="background-color:#ffffff;padding:2px 0 2px 1pt;text-align:left;vertical-align:bottom"><span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:400;line-height:100%">$</span></td> <td style="background-color:#ffffff;padding:2px 0;text-align:right;vertical-align:bottom"> <span style="color:#000000;font-family:'Times New Roman',sans-serif;font-size:10pt;font-weight:400;line-height:100%"> <ix:nonfraction unitref="usd" contextref="c-4" decimals="-3" name="us-gaap:CashAndDueFromBanks" format="ixt:num-dot-decimal" scale="3" id="f-33">145,342</ix:nonfraction> </span> </td> <td style="background-color:#ffffff;padding:2px 1pt 2px 0;text-align:right;vertical-align:bottom"></td> </tr> </tbody> </table>
Some time TD has direct data and some time TD has SPAN which has data. some time SPAN has custom tag which has data <ix:nonfraction
for a long time i am trying to loop through all TD's of all table and extract data only but getting no success.
here is my code which is trying to iterate and get data but code is not working.
<pre>var table1 = htmlDoc.DocumentNode.SelectNodes("//table");
var tbody = table1.ChildNodes["tbody"];
var lst = new List<Table1>();
foreach (var row in tbody.ChildNodes.Where(r => r.Name == "tr"))
{
var tbl1 = new Table1();
var columnsArray = row.ChildNodes.Where(c => c.Name == "td").ToArray();
for (int i = 0; i < columnsArray.Length; i++)
{
if (i == 0)
tbl1.Course = columnsArray[i].InnerText.Trim();
if (i == 1)
tbl1.Count = columnsArray[i].InnerText.Trim();
if (i == 2)
tbl1.Correct = columnsArray[i].InnerText.Trim();
}
lst.Add(tbl1);
}
Please some one guide me with a sample code which can extract data from html table TR,TD
please please need your support and help to extract data from html tables. thanks
|
|
|
|
|
Quote: but code is not working. Unfortunately that does not provide us with any useful information as to what happens when you run your code. Please edit your question, and add complete details of what is not working.
|
|
|
|
|
The name looked familiar, so I searched messages for it.
If it's the same person, and his question here fits the pattern in the days before, he's an old Assistive Nosferatu we terminated six years ago.
Just a heads up.
|
|
|
|
|
Thanks Dave. Let's see how this pans out.
|
|
|
|
|
What are you trying to say
pans out ??
|
|
|
|
|
I was replying to Dave Kreskowiak.
|
|
|
|
|
Why Dave said this ->
The name looked familiar, so I searched messages for it. what he is talking about?
|
|
|
|
|
It's a private conversation.
|
|
|
|
|
if private conversation then why you guys post text in my thread?
why do not create a new thread and gossip there?
|
|
|
|
|
Because you have a history here. One that got you booted before.
|
|
|
|
|
I wondered about that. I thought I'd seen the name. I was sure that Buffy had done her thing with Mr Pointy.
|
|
|
|
|
Tridip Bhattacharjee from Unknown wrote: code is not working.
Explain how it is not working.
Also explain what you did to determine exactly where it is failing.
|
|
|
|
|
Now it is working. i made some mistake in code. Thanks
|
|
|
|
|
getting too slow when connect c# desktop application with mysql cloud database
|
|
|
|
|
I am thinking you're going to need a lot more information than that.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
You're going to have to provide a LOT more information than that. There's only about a thousand things that can be wrong.
We know nothing about your code, how you're retrieving data, any locking involved, normalization, queries you're using, the database, its structure, indexing, ...
Absolutely nothing.
|
|
|
|
|
You would need to figure out exactly which part is slow.
Presuming that it actually a database call then you would need to look at the SQL statements that are being executed.
And the environment. So if you are running 100,000 clients it is going to be far different than if you are running 1.
|
|
|
|
|
Hi everyone,
I am new to this community and C# in general, (a PHP guy) but I am hoping I can get some help here. I am trying to have a page display 20 products then, a next button for the other 20 and so on. Below is the code of what I am trying to achieve. (link to image image_new_button.png - Google Drive[^] )
Thanks for your help in advance.
Best regards
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="winners.aspx.cs" Inherits="FrontPanel.winners" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div class="container">
<h4 class="paddingtb-15">Winner List </h4>
<table class="table table-striped table-bordered"><tr>
<th>Product Details</th>
<th>Amount</th>
<th>User Details</th>
</tr>
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<tr>
<td style="width:600px">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("productimage") %>' Width="30px" />
<%#Eval("productname") %>
</td>
<td><%#Eval("winamount") %></td>
<td> <asp:Image ID="Image2" runat="server" ImageUrl='<%#Eval("userimage") %>' Width="30px" Height="30px" CssClass="img-circle" /><%#Eval("username") %> </td>
</tr>
</ItemTemplate>
</asp:ListView>
</table> </div>
</asp:Content>
|
|
|
|
|
I don't see you retrieving any. Usually, the question would be: How do I retrieve the "next" 20? Then, the "previous" 20. And so forth.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Hi Gerry,
Yes, it does retrieve info already as shown in the screenshot I linked, but it displays it all on a single page. This would cause a lengthy page and users would have to scroll to the bottom which can be never ending. I am looking for a solution to have it display only 20 items per page, with a next and previous button as previously mentioned.
Thanks much
|
|
|
|
|
You didn't show the code that queries the database and returns it. I'm going to assume it's a simple query that returns everything in a table.
You're basically going to have to completely re-write that code, and the code you posted, so it can track which page the user is on, and take parameters for what to return, like the number of items per page and which page to return.
There's plenty of examples on the web for "ASP.NET database paging". All you have to do is search for that.
|
|
|
|
|
The plumbers are here and working in my apratment room so to pass the time I'v fired up my web browser and coming across your question, I'm prompted to provide a few links which might be helpful. One is at StackExchange and in this particular post there's another link which is to C# Corner. Check them out:
https://stackoverflow.com/questions/4293805/how-to-show-20-rows-on-datagrid-each-time[^]
Example of DataGrid in ASP.NET[^]
And to top all this off, there's another link that comes full circle back to CP:
Using ROW_NUMBER() to paginate your data with SQL Server 2005 and ASP.NET[^]
What I seem to do when I use someone elses code is try anything that remotely resembles what I want to see happen ... but of course the example/sample's got to compile first!. That second C#Corner webpage even shows images of the expected output from the running.
Perhaps too old that CP SQLServer suggestion but I've always had good luck fronting data with the various flavors of SQL and there's always a ton of it on SO.
|
|
|
|