)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get an object for the control present in an html element in WinForms HTMLUIControl?

Platform: WinForms |
Control: HTMLUIControl |
Published Date: April 30, 2011 |
Last Revised Date: January 3, 2020

HTML elements

The GetControlByElement() method of the IInputHTML Interface returns the control present in the specified HTML element. If the HTML element does not contain any controls in it, it returns a null value by default.

C#

//Initializing the respective control's object
private System.Windows.Forms.RadioButton htmlRadioButton;
private void htmluiControl1_LoadFinished(object sender, System.EventArgs e)
{
     //Collecting the html elements in a hashtable with their key as id
     Hashtable elements = this.htmluiControl1.Document.GetElementsByUserIdHash();
     BaseElement radioElem = (BaseElement)elements["radio1"];
     //Getting the Control from the html element and assigning it to the required object
     //The html element hereafter can be accessed with the help of the htmlRadioButton object
     htmlRadioButton = (RadioButton) this.htmluiControl1.Document.GetControlByElement(radioElem);
}

 

VB

'Initializing the respective control's object
Private htmlRadioButton As System.Windows.Forms.RadioButton
Private Sub htmluiControl1_LoadFinished(ByVal sender As Object, ByVal e As System.EventArgs)
    'Collecting the html elements in a hashtable with their key as id
    Dim elements As Hashtable = Me.htmluiControl1.Document.GetElementsByUserIdHash()
    Dim radioElem As BaseElement = CType(elements("radio1"), BaseElement)
    'Getting the Control from the html element and assigning it to the required object
    'The html element hereafter can be accessed with the help of the htmlRadioButton object
    htmlRadioButton = CType(Me.htmluiControl1.Document.GetControlByElement(radioElem), RadioButton)
End Sub

 

Reference link: https://help.syncfusion.com/windowsforms/html-viewer/html-elements

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon