windowsforms-devexpress-dot-xtraeditors-dot-htmlcontentcontrol-dot-findelementbyid-x28-system-dot-string-x29.md
Returns an HTML element with the specified ID.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public DxHtmlElement FindElementById(
string id
)
Public Function FindElementById(
id As String
) As DxHtmlElement
| Name | Type | Description |
|---|---|---|
| id | String |
The ID of an element to be retrieved.
|
| Type | Description |
|---|---|
| DxHtmlElement |
The element that has the specified ID.
|
You can use the ‘id’ attribute to specify an HTML element’s ID in HTML markup:
<div id="photo">Photo</div>
The FindElementById method allows you to retrieve an HTML element with the specified ID in code. A DxHtmlElement object returned by this method exposes properties that you can use to change element display settings. The main properties include:
element.Hidden — Allows you to hide the element.
element.Style — Allows you to modify CSS style properties applied to the element. This object exposes the SetBackgroundColor, SetForeColor, and SetProperty methods for this purpose.
var photo = htmlContentControl1.FindElementById("photo");
if (photo != null) photo.Hidden = true;
Dim photo = htmlContentControl1.FindElementById("photo")
If photo IsNot Nothing Then
photo.Hidden = True
End If
See the following topic for information on how to customize HTML elements with a specific ID in CSS code: CSS Styles - Id Selector.
See Also