Getting combobox value

3 posts, 0 answers
  1. Web
    Web avatar
    88 posts
    Member since:
    Nov 2006

    Posted 15 Dec 2006 Link to this post

    I am populating the text and values of a rad combobox from a hashtable using the following code:

       while (Enumerator.MoveNext())
                {
                    cboOutputFormat.Items.Add(new RadComboBoxItem(Enumerator.Value.ToString(),(int)Enumerator.Key));
    }

    but when I try to retrieve the value of the selected item using:

    int val = (int)((RadComboBoxItem)cboOutputFormat.SelectedItem).Value;

    it comes up null... what am I doing wrong?
  2. Web
    Web avatar
    88 posts
    Member since:
    Nov 2006

    Posted 15 Dec 2006 Link to this post

    figured it out.

    Assigning the value through the constructor doesn't seem to work properly. If you create a new RadComboBoxItem and assign the value property, it works.

    Thanks
  3. UI for WinForms is Visual Studio 2017 Ready
  4. aban
    aban avatar
    1 posts
    Member since:
    Apr 2007

    Posted 16 Apr 2007 Link to this post

    Do you mean create one new RadComboBoxItem object, and don't use convert value (RadComboBoxItem)?

    I will try this, Thanks.
Back to Top