This is a migrated thread and some comments may be shown as answers.

Convert current selected item to datarow

1 Answer 152 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
michael knight
Top achievements
Rank 1
michael knight asked on 11 May 2011, 10:33 AM
There is a nice useful snippet when using standard MS combobox to track current selected item in a table based on the current selected item of the combobox. This snippet can be accessed using VS 2008 and upward i dont know about 2005. (InsertSnippet> Data - LinQ/XML/Desinger/ADO.NET blah blah> Designer Features and ADO.net> ConvertBindingsource.Current to a specific row in a DataTable)

Using the standard VS shipped combobox it works giving me the option to define it like this:
Dim row As MyProjectDataSet.tblStaffRow<br>        row = CType(CType(Me.ComboBoxStaff.SelectedItem, DataRowView).Row, MyProjectDataSet.tblStaffRow)
and then Dim for example put it into a variable like:
myArrayVariable.Add(row.StaffName)

This however doesn't work for telerik q1 2011 winform RadDropDownList. can anyone help me with this?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 May 2011, 04:57 PM
Hi michael knight,

You should cast the SelectedItem.DataBoundItem to DataRow. Consider the following example:

Dim row As MyProjectDataSet.tblStaffRow<br>        row = CType(CType(Me.ComboBoxStaff.SelectedItem.DataBoundItem, DataRowView).Row, MyProjectDataSet.tblStaffRow)

I hope this helps.

Kind regards, Peter
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
DropDownList
Asked by
michael knight
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or