Skip to main content
All docs
V24.1

HtmlContentControl.FindElementsByTag(String) Method

Returns a list of HTML elements that have the specified tag.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public IEnumerable<DxHtmlElement> FindElementsByTag(
    string name
)

Parameters

Name Type Description
name String

The tag of HTML elements to be retrieved.

Returns

Type Description
IEnumerable<DxHtmlElement>

A list of HTML elements that have the specified tag.

Remarks

The FindElementsByTag method allows you to retrieve HTML elements (DxHtmlElement objects) that have the specified tag. A DxHtmlElement object exposes properties that you can use to change element display settings in code. 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.

The following code locates and hides images (elements defined by the ‘img’ tag):

var elements = htmlContentControl.FindElementsByTag("img");
foreach (DxHtmlElement el in elements) {
    el.Hidden = true;
}

See the following topic for information on how to customize HTML elements with a specific ID in CSS code: CSS Styles - Tag Selector.

See Also