本文介绍了DevExpress在ClientSide中获取ASPxComboBox的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASPxGridview包含ASPxComboBox的一个字段我想要获取一个ASPxComboBox的选定的值并显示在一个标签。在我下面的代码中,我只是将值保存在alert()消息中。但是我得到的是一个null的值。任何人都知道如何解决我的问题?非常感谢你。



这是我到目前为止

 < dx:ASPxGridView ID =ASPxGridView2OnRowDataBound =ASPxGridView2_RowDataBoundClientInstanceName =gridrunat =serverAutoGenerateColumns =FalseDataSourceID =fordtlKeyFieldName =chndtl_no> 

< dx:GridViewDataTextColumn FieldName =productName =dd_productShowInCustomizationForm =trueVisibleIndex =7>
< SettingsHeaderFilter>
< DateRangePickerSettings EditFormatString =/>
< / SettingsHeaderFilter>
< EditItemTemplate>
< dx:ASPxComboBox ID =ASPxComboBoxProductrunat =serverClientInstanceName =averyAutoPostBack =trueDataSourceID =ProductEnableCallbackMode =trueTextField =pd_product>
< ClientSideEvents SelectedIndexChanged =function(s,e){OnProductChanged(s);}>< / ClientSideEvents>
< / dx:ASPxComboBox>
< / EditItemTemplate>
< / dx:GridViewDataTextColumn>

< / dx:ASPxGridView>

JavaScript

  function OnProductChanged(s,e){
var getProduct = document.getElementById(ASPxComboBoxProduct);
alert(getProduct);
}


解决方案

-

 < ClientSideEvents SelectedIndexChanged =function(e,s){OnProductChanged();}> 
< / ClientSideEvents>

从此替换您的JavaScript函数并检查。

  function OnProductChanged(e,s)
{
var selectedValue = e.lastSuccessValue;
alert(selectedValue);
}


I have a ASPxGridview that contains a field with ASPxComboBox I want to get the selected value of a ASPxComboBox and display it in a label. In my code below I just store the value on alert() message. But all I'm getting is a "null" value.Can anyone know how to solve my problem? Thank you so much.

Here's what I have so far

<dx:ASPxGridView ID="ASPxGridView2" OnRowDataBound="ASPxGridView2_RowDataBound" ClientInstanceName="grid" runat="server" AutoGenerateColumns="False" DataSourceID="fordtl" KeyFieldName = "chndtl_no">

<dx:GridViewDataTextColumn FieldName="product" Name="dd_product" ShowInCustomizationForm="true" VisibleIndex="7">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
<EditItemTemplate>
<dx:ASPxComboBox ID="ASPxComboBoxProduct" runat="server" ClientInstanceName="avery" AutoPostBack="true" DataSourceID="Product" EnableCallbackMode="true" TextField="pd_product">
<ClientSideEvents SelectedIndexChanged="function(s, e) { OnProductChanged(s);}"></ClientSideEvents>
</dx:ASPxComboBox>
</EditItemTemplate>
</dx:GridViewDataTextColumn>

</dx:ASPxGridView>

JavaScript

function OnProductChanged(s, e) {
   var getProduct = document.getElementById("ASPxComboBoxProduct");
   alert(getProduct);
}
解决方案

Replace this in you aspx code -

<ClientSideEvents SelectedIndexChanged="function(e,s) { OnProductChanged();}">
</ClientSideEvents>

Replace your javascript function from this and check.

function OnProductChanged(e, s)
{
      var selectedValue = e.lastSuccessValue;
      alert(selectedValue);
}

这篇关于DevExpress在ClientSide中获取ASPxComboBox的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:15