Skip to main content
A newer version of this page is available. .

ASPxTreeList.FindDataCellTemplateControl(String, TreeListDataColumn, String) Method

Searches for the server control contained within the specified data cell’s template.

Namespace: DevExpress.Web.ASPxTreeList

Assembly: DevExpress.Web.ASPxTreeList.v19.2.dll

Declaration

public Control FindDataCellTemplateControl(
    string nodeKey,
    TreeListDataColumn column,
    string id
)

Parameters

Name Type Description
nodeKey String

A String value that identifies the node.

column TreeListDataColumn

A TreeListDataColumn object that represents the data column where the requested cell resides. If null (Nothing in Visual Basic), the search is performed within all cells in the specified node.

id String

A String value that identifies the control within the specified cell.

Returns

Type Description
Control

A Control object that represents the control contained within the specified data cell’s template.

Remarks

To learn more, see Templates.

Example

In this example, the ASPxTreeList.HtmlRowPrepared event is handled to display appropriate images within data cells. The ASPxTreeList.FindDataCellTemplateControl method is used to access ASPxImage and ASPxLabel template controls contained within data cells.

The image below shows the result:

cdAccessTemplateCtrls

protected void ASPxTreeList1_HtmlRowPrepared(object sender,
DevExpress.Web.ASPxTreeList.TreeListHtmlRowEventArgs e) {
    if(e.RowKind != DevExpress.Web.ASPxTreeList.TreeListRowKind.Data) return;
    ASPxImage img = ASPxTreeList1.FindDataCellTemplateControl(e.NodeKey,
      ASPxTreeList1.Columns["Product"] as TreeListDataColumn, "ASPxImage1") as ASPxImage;
    ASPxLabel lb = ASPxTreeList1.FindDataCellTemplateControl(e.NodeKey,
      ASPxTreeList1.Columns["Product"] as TreeListDataColumn, "ASPxLabel1") as ASPxLabel;
    if (ASPxTreeList1.FindNodeByKeyValue(e.NodeKey).HasChildren) {
        img.ImageUrl = @"~\i\product-group.png";
        lb.Font.Size = 12;
        lb.Font.Bold = true;
    }
    else
        img.ImageUrl = @"~\i\product.png";
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the FindDataCellTemplateControl(String, TreeListDataColumn, String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also