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

ListEditItemBase.SetFieldValue(String, Object) Method

Sets the data field’s value.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public void SetFieldValue(
    string fieldName,
    object value
)

Parameters

Name Type Description
fieldName String

A String value that specifies the field’s name.

value Object

The data field’s value.

Remarks

Use the SetFieldValue method to set the value of the specified data field.

<dx:ASPxComboBox ID="ComboBox1" runat="server" ClientInstanceName="comboBox1" ...>
    ...
</dx:ASPxComboBox>
comboBox1.SetFieldValue("Name", "Value1");
comboBox1.SetFieldValue("Address", "Value2");
comboBox1.SetFieldValue("City", "Value3");

In bound mode, use the following APIs to rebind an editor on each request:

  • Enable the ASPxListEdit.ForceDataBinding property if you use the DataSourceID property to bind the editor to a data source.

  • Use the DataBind method if you use the DataSource property to bind the editor.

Note

Use the client-side InsertItem(index, text) method to add a new item and set the EnableSynchronization property to true to set specific field values for the newly inserted items on the server side.

<dx:ASPxComboBox ID="ComboBox1" runat="server" DataSourceID="SqlDataSource1" ValueType="System.String" EnableSynchronization="True" ...>
    <ClientSideEvents Init="OnComboboxInit" />
    <Columns>
        <dx:ListBoxColumn FieldName="TestName" Caption="Test Caption" />
    </Columns>
</dx:ASPxComboBox>
function OnComboboxInit(s, e) {
    s.InsertItem(0, "Text1", "Value1");
}
See Also