Skip to main content
Tab

ListEditItemBase.GetFieldValue(String) Method

Returns the value of the specified data field of the list item.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public object GetFieldValue(
    string fieldName
)

Parameters

Name Type Description
fieldName String

A String value that identifies a data field. This value specifies the name of the data field.

Returns

Type Description
Object

An Object that is the specified data field’s value in the list item.

Remarks

Use the GetFieldValue method to get the value of the specified data field of the list item if an editor is bound to a data source.

View Example: Combo Box for ASP.NET Web Forms - How to get hidden column values on the client

If an editor is bound to a data source using the DataSourceID property, use the ASPxListEdit.ForceDataBinding to enable an editor to rebind automatically. For editors that are bound to a data source using the DataSource property, the DataBind method should be called for each request to the editor’s items.

Example

This example illustrates how to use the ListEditItemBase.GetFieldValue method to get the editor’s items. To review the full example, refer to the Item Appearance Customization online demo.

string GetItemTooltip(ListEditItem item) {
    return string.Format("Country: {0}\r\nCity: {1} \r\nAddress: {2}",
        item.GetFieldValue("Country"), item.GetFieldValue("City"), item.GetFieldValue("Address"));
}
protected void customersComboBox_ItemTextCellPrepared(object sender, ListBoxItemTextCellPreparedEventArgs e) { 
    if(e.Column.FieldName == "ContactName") {
        string contactTitle = e.Item.GetFieldValue("ContactTitle").ToString();
        if(contactTitle == "Owner") {
            e.TextCell.CssClass += " owner";
            e.TextCell.ToolTip = "Owner";
        }
    }
    if(e.Column.FieldName == "Phone")
        e.TextCell.CssClass += " phone";
}
    protected void customersComboBox_ItemRowPrepared(object sender, ListBoxItemRowPreparedEventArgs e) {
        e.Row.ToolTip = GetItemTooltip(e.Item);
    }
See Also