Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
I use Infragistics UltraWinGrid.UltraCombo Box
posted

I set the DataSource to a two column DataTable

I set the ValueMember to the first column

I set the DisplayMember to the second column

Once the user selects a row, How can I see the "SelectedValue", like I could with a WIndows ComboBox?

UltraCombo1.Value is an object. I just want the first column value of the selected row.

  • 1560
    Offline posted

    Hello,

    My suggestion is using the Cells property of the UltraCombo's SelectedRow. This property contains a collection of all cells in the selected row and a particular cell (the first one) could be accessed by index or name.

    private void ultraCombo1_ValueChanged(object sender, EventArgs e)
            {           
                UltraGridRow selectedRow = this.ultraCombo1.SelectedRow;
                string selectedValue = selectedRow.Cells[0].Value.ToString();        
              
            }

    I have attached a sample application, that demonstrates this suggestion. Please test it on your side and let me know if I may be of any further assistance.

    Sincerely,

    Teodosia Hristodorova

    Associate Software Developer

    2816.UltraCombo_get_selected_value.zip

  • 469350
    Verified Answer
    Offline posted

    Um... why can't you use the Value property? 

    Value will return the DataValue of the row the user selected. So that seems like it's exactly what you want. The property if of type Object because you can use any data type and your ValueMember column can be any data type. And the SelectedValue of the inbox ComboBox control is also an object. So that seems like it's exactly what you want.

    SelectedRow is actually not a good thing to use, because the SelectedRow will not be set if, for example, you load up your application and set the value of the combo (as opposed to the user dropping down the list and choosing an item).