代码改变世界

如何根据下拉框选中的数据获取相关的数据

2007-07-09 19:38  IT篮球者  阅读(1059)  评论(0)    收藏  举报

1.0 摘要

 

本文将介绍如何根据下拉框中选中的数据获取指定的数据。

2.0 内容

 

a.  UltraComboEditor

因为UltraComboEditor使用_SelectionChanged事件也可以取值(.Text取得显示的文本,.Value取得Item对应的Value)

private void ultraComboEditorTest_SelectionChanged(object sender, EventArgs e)

{

    labelValue.Text = ultraComboEditorTest.Value.ToString();

        labelText.Text = ultraComboEditorTest.Text.ToString();

    }

 

b. UltraCombo

因为UltraCombo的下拉呈现是Grid,所以取得所选行的某一单元格的值也类似于UltraGrid的取值,通过_RowSelected事件(.Text.Value取得相同的值)

private void ultraComboTest_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)

{

    if (e.Row != null)

    {

        labelCombo.Text = e.Row.Cells["Name"].Value.ToString();

    }

}

 

c.  UltraDropDown

UltraDropDownUltraCombo类似,同样是通过_RowSelected事件来取值(.Text.Value取得相同的值):

private void ultraDropDownTest_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)

{

    if (e.Row != null)

    {

        ultraTextEditorTest.Text = e.Row.Cells["Name"].Value.ToString();

    }

}