Click here to Skip to main content
15,904,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All.

I need to read a HTML file in c# and then bind the data to a gridView.

I am able to read the content of HTML file using a web-browser control,
but data is in raw format :( .

Can anybody suggest some way to get it done.
I had tried searching for any proper resource for it, but was unsuccessful.

Please somebody help me to resolve this issue.

Thank in advance.
Posted

You can read it as XML.
C#
using System.Xml;

XmlDocument xd = new XmlDocument();

xd.LoadXml("FilePath");


This tutorial may help: "Reading and Writing XML in C#".


 
Share this answer
 
v2
We can have the clear idea if you can represent your data,

but I found this link to be useful
http://www.acruxsoftware.net/html-parser-csharp-vb.net-xpath/htmlparser.htm[^]
If you want to parse HTML, or you could use Xpath Navigation for XML(try 'google').

Please vote and Accept Answer if it Helped.
 
Share this answer
 
v2
Comments
Pankaj Babre 30-Sep-10 2:20am    
Thanks Hiren,

I am having my data in a Table in html page.
The link yo have provided is seems to be broken
not opening at all. Can u provide some alternative link.
Hiren solanki 30-Sep-10 2:22am    
sorry for that, I have updated link.
Pankaj Babre 1-Nov-10 9:33am    
Thank you Hiren,
htmlparser worked like a breeze for me...
try to use the linq to xml
it is easy
[]
 
Share this answer
 
Comments
HimanshuJoshi 30-Sep-10 13:53pm    
Post your answer only once. You are spamming the forum

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900