Back to Devexpress

ASPxComboBox.Value Property

aspnet-devexpress-dot-web-dot-aspxcombobox-16fa429b.md

latest6.1 KB
Original Source

ASPxComboBox.Value Property

Gets or sets the editor’s edited value.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public override object Value { get; set; }
vb
Public Overrides Property Value As Object

Property Value

TypeDescription
Object

A Object value representing the editor’s value.

|

Remarks

Use the Value property to manipulate the editor’s value.

If you need to validate the editor’s value before posting it, you can handle either the client-side ASPxClientEdit.Validate or server-side ASPxEdit.Validate events, or both. If no validation is performed and the value posted is incorrect, then an exception is raised.

Note

If the ASPxComboBox’s ASPxAutoCompleteBoxBase.Items collection is not initialized, Value returns the ASPxComboBox.SelectedItem‘s ListEditItem.Text property value.

If the Value property returns null, make sure that you set the ValueType property to an .NET type that matches the ValueField column type. Otherwise, the editor cannot find the corresponding item because the editor’s ValueType property does not match the item type (String by default).

The following code snippets (auto-collected from DevExpress Examples) contain references to the Value property.

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.

asp-net-web-forms-grid-use-cascading-combo-boxes-in-inline-edit-mode/CS/MultiCombo/Default.aspx.cs#L10

csharp
object oldCat1 = Session["Cat1ID"];
if(oldCat1 != null && oldCat1.Equals(combo1.Value)) return;
Session["Cat1ID"] = combo1.Value;

asp-net-web-forms-scheduler-custom-adaptive-form-using-templates/CS/WebApplication1/DevExpress/ASPxSchedulerForms/AppointmentForm.ascx.cs#L178

csharp
cbRecurrenceType.Value = container.RecurrenceType.ToString();

asp-net-web-forms-grid-initialize-editor-conditionally/CS/WebApplication_Grid/Templates/CustomEditItemTemplate.cs#L38

csharp
cmb.DataBind();
cmb.Value = dataValue;
container.Controls.Add(cmb);

reporting-web-forms-view-report/CS/T132094/Default.aspx.cs#L35

csharp
protected void btPreview_Click(object sender, EventArgs e) {
    string reportName = (string) cbReportType.Value;

asp-net-web-forms-grid-use-cascading-combo-boxes-in-inline-edit-mode/VB/MultiCombo/Default.aspx.vb#L12

vb
Dim oldCat1 As Object = Session("Cat1ID")
If oldCat1 IsNot Nothing AndAlso oldCat1.Equals(combo1.Value) Then
    Return

asp-net-web-forms-scheduler-custom-adaptive-form-using-templates/VB/WebApplication1/DevExpress/ASPxSchedulerForms/AppointmentForm.ascx.vb#L186

vb
cbRecurrenceType.Value = container.RecurrenceType.ToString()

asp-net-web-forms-grid-initialize-editor-conditionally/VB/WebApplication_Grid/Templates/CustomEditItemTemplate.vb#L38

vb
cmb.DataBind()
cmb.Value = dataValue
container.Controls.Add(cmb)

reporting-web-forms-view-report/VB/T132094/Default.aspx.vb#L34

vb
Protected Sub btPreview_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim reportName As String = CStr(cbReportType.Value)

See Also

SelectedIndex

SelectedItem

Combo Box

ASPxComboBox Class

ASPxComboBox Members

DevExpress.Web Namespace