I am experiencing a strange behavior on the RadDropDownList when its datasource is a DataView. I created an empty project to eliminate other possible factors.
On initial load, I set the datasource to a global dataview object, as well as the ValueMember and DisplayMember. The dropdownlist is populated when clicking a single button. As expected, the data is shown correctly.
If the dataview is refreshed multiple times (button clicked again), the data is shown correctly. However, if the user drops down the listbox before refreshing the data, the text for the items in the dropdownlist changes to "System.Data.DataRowView".
I have tried resetting the datasource, displaymember, valuemember, and performing a rebind after refreshing the data. I still encounter the same issue.
Test code is below. To see the strange behavior, add "RadDropDownList1.ShowDropDown()" after refreshing the data. Or simply display the dropdownlist before clicking the button.
Possible bug???? This can't be by design. :-) This behavior does not occur with the MS dropdownlist control. I have the latest version (2011.1.11.419).
On initial load, I set the datasource to a global dataview object, as well as the ValueMember and DisplayMember. The dropdownlist is populated when clicking a single button. As expected, the data is shown correctly.
If the dataview is refreshed multiple times (button clicked again), the data is shown correctly. However, if the user drops down the listbox before refreshing the data, the text for the items in the dropdownlist changes to "System.Data.DataRowView".
I have tried resetting the datasource, displaymember, valuemember, and performing a rebind after refreshing the data. I still encounter the same issue.
Test code is below. To see the strange behavior, add "RadDropDownList1.ShowDropDown()" after refreshing the data. Or simply display the dropdownlist before clicking the button.
Possible bug???? This can't be by design. :-) This behavior does not occur with the MS dropdownlist control. I have the latest version (2011.1.11.419).
Imports
System.Data.SqlClient
Public
Class
Form1
Private
_dvNames_List
As
New
DataView
Private
Sub
Button1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
Button1.Click
Dim
sSQLConnection
As
String
=
"MYSQLCONNECTION"
Dim
oConn
As
New
SqlConnection(sSQLConnection)
Dim
oCommand
As
New
SqlCommand
Dim
oDT
As
New
DataTable
Dim
oDA
As
SqlDataAdapter
Try
oConn.Open()
With
oCommand
.Connection = oConn
.CommandTimeout = 15
.CommandType = CommandType.StoredProcedure
.CommandText =
"cp_MyStoredProc"
End
With
oDA =
New
SqlDataAdapter(oCommand)
oDA.Fill(oDT)
oDT.TableName =
"SQLDATATABLE"
_dvNames_List.Table = oDT
Catch
ex
As
Exception
Throw
New
Exception(ex.Message, ex)
End
Try
End
Sub
Private
Sub
Form1_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
RadDropDownList1.ValueMember =
"nameid"
RadDropDownList1.DisplayMember =
"name"
RadDropDownList1.DataSource = _dvNames_List
End
Sub
End
Class