ComboBox在将TextFormatString设置为" {0},{1}"时返回选定值Null在DevExpress?

时间:2013-07-16 04:34:34

标签: asp.net devexpress

我需要在我的下拉列表中搜索两个列,例如:Code&说明,如果我输入文本,它将在我的两个列中搜索。如何在ASPx ComboBox中执行此操作?

我已经TextFormatString="{0},{1}"搜索正在运行,但在SelectedItem.Value中返回Null。如何解决这个问题?

我的代码:

<dxe:ASPxComboBox ID="cmbCurrencyGuarDetails" SkinID="ComboBoxList" 
                  runat="server" Width="100%" 
                  ClientInstanceName="cmbCurrencyGuarDetails" 
                  DropDownStyle="DropDownList" 
                  ValueType="System.String" 
                  TextFormatString="{0},{1}"
                  EnableCallbackMode="true" 
                  IncrementalFilteringMode="Contains"
                  CallbackPageSize="100">

先谢谢。

3 个答案:

答案 0 :(得分:0)

您应该设置ValueField。在客户端,您可以使用cmbCurrencyGuarDetails.GetValue()直接获取价值。

答案 1 :(得分:0)

我怀疑你的标记已经设置了ValueField Property

  

如果启用了 EnableIncrementalFiltering 属性,则键入值   在编辑器中搜索最终用户进入编辑框   list,基于TextFormatString属性的已定义格式。

     

如果未定义编辑器的ASPxComboBox.ValueField属性,则   使用使用TextFormatString属性格式化的文本值   作为编辑的价值。

e.g。

 <dxe:ASPxComboBox ID="cmbCurrencyGuarDetails" SkinID="ComboBoxList" 
                      runat="server" Width="100%" 
                      ClientInstanceName="cmbCurrencyGuarDetails" 
                      DropDownStyle="DropDownList" 
                      ValueType="System.String" 
                      TextFormatString="{0},{1}"
                      EnableCallbackMode="true" 
                      IncrementalFilteringMode="Contains"
                      ValueField="CustomerID" /// If object data source then mention property here
                      CallbackPageSize="100">

参考文献:
DevExpress ASPxComboBox not filtering

答案 2 :(得分:0)

您可以使用;

选择值
cmbCurrencyGuarDetails.Value

如果您没有在服务器端添加ValueField,则必须添加

<dxe:ASPxComboBox ValueField="ID"  ... >
相关问题