Returning the ID of a selected Item

2 posts, 0 answers
  1. Eddie
    Eddie avatar
    2 posts
    Member since:
    Oct 2012

    Posted 06 Dec 2007 Link to this post


    If I bind to a datatable, how can I get the ID of the selected item in the combo box. I have added the following code

    Dim pobjTable As New Data.DataTable



    pobjTable.Rows.Add(1001, "User A")

    pobjTable.Rows.Add(1002, "User C")

    pobjTable.Rows.Add(1003, "User B")

    RadComboBox1.DataSource = pobjTable

    RadComboBox1.DisplayMember = "Name"

    So if User C is selected, I would like to get 1002 back as the ID.

    Note: This is possible in the VB.Net Combo Box if you create a class to store the ID and the Text Value. You can add an object to the List and return the Object once selected.

    Best Regards

  2. Georgi
    Georgi avatar
    212 posts

    Posted 07 Dec 2007 Link to this post

    Hi Eddie,

    Yes, this is possible with our RadComboBox. You just have to set the ValueMember property to "ID". Then you can access the corresponding value for the currently selected item through the SelectedValue property.

    If you have any additional questions, please do not hesitate to write us again.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
Back to Top