我们如何阅读“查看页面源代码" Webbroswer中的代码? [英] How can we read the "View Page Source" Code in the Webbroswer?

查看:103
本文介绍了我们如何阅读“查看页面源代码" Webbroswer中的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要阅读页面源代码中的Table内容.对于渲染后的普通HTML表和网格视图,将其转换为HTML也需要查找内容.请建议我一些好的链接.我需要在Asp.Net中使用C#在文本文件中找到表的内容.
提前感谢:-)

Hi ,I have a requirement to read the Table content in the page source code. For normal HTML tables and grid view after rendering convert into HTML also i need to find the content. Please suggest me some good links. I need to find the content of the Table in the Text File using C# in Asp.Net.
Thanks in-advance:-)

推荐答案

我想您正在使用Web浏览器控件,如果可以的话,这可能会对您有所帮助.


使用此方法仅获取表的内容:

HtmlElement他= webBrowser.Document.GetElementById("table-id");
字符串pagesource = he.InnerHtml;

如果需要页面源中的所有内容,请使用:

HtmlElementCollection hec = webBrowser.Document.All;
I guess you are using webbrowser control, If So this may help you.


use this to get only the content of the table:

HtmlElement he = webBrowser.Document.GetElementById("table-id");
string pagesource = he.InnerHtml;

If you need all the content in the pagesource then use:

HtmlElementCollection hec = webBrowser.Document.All;


这篇关于我们如何阅读“查看页面源代码" Webbroswer中的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆