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

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.v24.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.

HTML
<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