Devexpress如何在ComboBox DataBinding方法中获取索引行?

时间:2017-09-01 15:17:29

标签: c# asp.net devexpress

<dx:GridViewDataComboBoxColumn Caption="<%$Resources: zione%>" Width="15%" Visible="true">                                
    <DataItemTemplate>
        <dx:ASPxComboBox ID="comboZione" 
                      runat="server" 
                      ValueField="TIPB_CTBZIONE"
                      TextField="DEFI_CTBZIONE" 
                      OnDataBinding="comboZione_OnDataBinding" 
                      EnableCallbackMode="false" 
                      OnSelectedIndexChanged="combo_OnSelectedIndexChanged">
        </dx:ASPxComboBox>
    </DataItemTemplate>
</dx:GridViewDataComboBoxColumn>

在代码背后:

protected void comboZione_OnDataBinding(object sender, EventArgs e)
{
    ASPxComboBox cmb = (sender as ASPxComboBox);
    cmb.DataSource = ddlLoadZione(IndexRow);
    // Here I want to bind the different combox on which row, 
    // but I needed a index row to do this. 
}

索引行需要我获得该行的正确值。

Grid.GetRowValues(**IndexRow**, "FieldName")

1 个答案:

答案 0 :(得分:0)

要完成此任务,我建议您使用The general technique of using the Init/Load event handler文章中描述的方法并设置组合框&#39; Init事件处理程序中的DataSource属性。

我相信有可能:

  1. 处理ASPxComboBox.Init事件;
  2. 根据您的自定义条件(行值等)提供ASPxComboBox.DataSource。
  3. 请参阅:
    ASPxGridView - Bind ASPxComboBox placed in DataItemTemplate
    ASPxGridView - How to bind controls placed in the DataItemTemplate with the data field of the grid row
    ASPxComboBox on each line / DataItemTemplate of ASPxGridView
    ASPxGridView - How to bind ASPxComboBox in the data item template