Category / Section
How to access the HTML text, including the start and end tag of the current HTML element in WinForms HTMLUIControl?
4 mins read
HTML element
The HTML text of the current element is accessed with the help of the OuterHTML property. This property returns the HTML text of an element along with the start and end tags as output.
The following HTML document contains a div element. The code snippet shows how the HTML text of the element is accessed and displayed in the output at run-time.
C#
Hashtable htmlelements = this.htmluiControl1.Document.GetElementsByUserIdHash(); DIVElementImpl div1 = this.htmlelements["div1"] as DIVElementImpl; Console.WriteLine(div1.OuterHTML.ToString());
VB
Dim htmlelements As Hashtable = Me.htmluiControl1.Document.GetElementsByUserIdHash() Dim div1 As DIVElementImpl = TryCast(Me.htmlelements("div1"), DIVElementImpl) Console.WriteLine(div1.OuterHTML.ToString())
Reference link: https://help.syncfusion.com/windowsforms/html-viewer/html-elements