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
154
How to return the selected object in a combo box?
posted

Hello, friends,

In our c#.net app, we need Infragistics combo box to display a collection of user defined class, say UserInfoCollection for a user defined class UserInfo, like the following;

this.cmbUser.DataSource = userInfoCollection;

After a user selects a row, we need to get the selected user information in a UserInfo class. (Of course, we might be able to go to each cell in the selected row, and reconstruct a UserInfo class, but this does not sound the right way)

How can we do this? Thanks a lot!

 

  • 469350
    Verified Answer
    Offline posted

     You can use ultraCombo.SelectedRow to get the Row, then use the ListObject property of the row to get the underlying object from the data source. 

    • 154
      posted in reply to Mike Saltzman

      thanks!

      • 1210
        posted in reply to Mihir

        mjoshi said:

        I have a similar problem like above. I am binding my datasource to the ultracombo control. At the time of saving the value in my table I use ultracombo.value property to get the values of the selectedrow. Now I need to set the selectedrow runtime with the saved value in my table. I am used to selectedtext and selectedindex property of winforms combo, but cant get the idea how to set the selectedrow in ultracombo. Can anybody help? I would appreciate if elaborated with example and code.

        If you set valuemember property then you can use

        ultraCombo.Value = SavedValue;

        for  winforms combo you can set

        winformCombo.selectedValue = SavedValue;

        • 469350
          Verified Answer
          Offline posted in reply to Mihir

           I'm not sure what you are asking.You can get or set the SelectedRow property on the UltraCombo control. 

          • 35
            posted in reply to Andrew

            I have a similar problem like above. I am binding my datasource to the ultracombo control. At the time of saving the value in my table I use ultracombo.value property to get the values of the selectedrow. Now I need to set the selectedrow runtime with the saved value in my table. I am used to selectedtext and selectedindex property of winforms combo, but cant get the idea how to set the selectedrow in ultracombo. Can anybody help? I would appreciate if elaborated with example and code.