Skip to main content
All docs
V24.2

HtmlContentControl.FindElementById(String) Method

Returns an HTML element with the specified ID.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

public DxHtmlElement FindElementById(
    string id
)

Parameters

Name Type Description
id String

The ID of an element to be retrieved.

Returns

Type Description
DxHtmlElement

The element that has the specified ID.

Remarks

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;

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