Skip to main content
All docs
V23.2

DxHtmlPainterArgs.SetFieldValue(String, Object) Method

Allows you to assign the required data portion to the target HTML element.

Namespace: DevExpress.Utils.Html

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public void SetFieldValue(
    string fieldName,
    object value
)

Parameters

Name Type Description
fieldName String

The name of a data field to which the HTML element is bound.

value Object

Data assigned to the HTML element.

Remarks

The markup below illustrates an HTML element bound to the “UnboundDataField” field.

<div class="container">
    <div id="btn_1" class="customDrawBtn">${UnboundDataField}</div>
</div>

The following code retrieves values from the “SolarObjectTypes” dictionary and assigns them to elements bound to this field.

void OnCustomDrawCell(object sender, RowCellCustomDrawEventArgs e) {
    e.DefaultDraw();
    e.Handled = true;
    GridView view = sender as GridView;
    string objectName = view.GetRowCellValue(e.RowHandle, view.Columns["Name"]) as string;
    if (e.Column.FieldName == "Name")
        e.DrawHtml(htmlTemplateCollection1[0], args => {
            // Retrieve values from the "SolarObjectTypes" dictionary
            args.SetFieldValue("UnboundDataField", SolarObjectTypes[objectName]);
    });
}
See Also