ComboBox column in DataGridView

Discussion in 'ASP .Net Datagrid Control' started by David, Mar 30, 2005.

  1. David

    David Guest

    This isn't exactly about DataGrid. It's about DataGridView, but I'm hoping
    this newsgroup is close enough. I have a ComboBox type column in a
    DataGridView. (VS 2005, .Net 2.0 Beta
    versions)

    This is an unbound column. No datasource, datamember, or valuemember is
    defined. The columns all have an item list.

    Is there a simple way to get at the selected index of the combobox in a cell
    from that column? For a given cell, I want to get at the SelectedIndex
    property of the combobox in that cell. As it is, all I can seem to do is get
    at the Value property, which will return the corresponding string. Since it
    is an unbound column, I don't have any way of associating a DataMember with
    the list of items. (Do I?)

    So, the only way I can see to do what I want is to retrieve the Value
    property, and then compare that to each item in the list until I get a match,
    and then return the position in the list from which the Value was found.
    (And if there are two identical items, even that wouldn't work.) Can I get
    directly at the selected index value in the DataGridViewComboBoxCell if that
    column is an unbound column?
    David, Mar 30, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dbuchanan
    Replies:
    7
    Views:
    7,401
    jtsmith2
    May 23, 2006
  2. =?Utf-8?B?Rmlyb3o=?=

    Forms inheritance - datagridview

    =?Utf-8?B?Rmlyb3o=?=, Jan 6, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,429
    =?Utf-8?B?Rmlyb3o=?=
    Jan 6, 2006
  3. =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?=

    RE: DataGridView with databound combobox

    =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?=, Mar 16, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    11,283
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Apr 2, 2006
  4. SAM
    Replies:
    0
    Views:
    404
  5. Replies:
    5
    Views:
    464
    Roedy Green
    Oct 11, 2012
Loading...

Share This Page