Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

HtmlContentControl.FindElementsByTag(String) Method

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

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.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