-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathhtmlparser.aspx.cs
More file actions
67 lines (58 loc) · 1.64 KB
/
htmlparser.aspx.cs
File metadata and controls
67 lines (58 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CleverComponents.InetSuite;
namespace inetsuitedemocs
{
/// <summary>
/// Summary description for htmlparser.
/// </summary>
public partial class htmlparser : System.Web.UI.Page
{
protected CleverComponents.InetSuite.HtmlParser htmlparser1;
protected CleverComponents.InetSuite.Http http1;
protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.htmlparser1 = new CleverComponents.InetSuite.HtmlParser();
this.http1 = new CleverComponents.InetSuite.Http();
}
#endregion
protected void Button1_Click(object sender, System.EventArgs e) {
string html = http1.Get(edtUrl.Text);
htmlparser1.Parse(html);
DataTable links = new DataTable();
links.Columns.Add("Url");
foreach (CleverComponents.InetSuite.HtmlLink link in htmlparser1.Links) {
DataRow row = links.NewRow();
row["Url"] = link.Href;
links.Rows.Add(row);
}
DataGrid1.DataSource = links;
DataGrid1.DataBind();
}
}
}