Hey all,
My apologies if this has already been posted - I swear I couldn't find it.
Using the Q3 2011 controlls (2011.3.11.1116):
I'm binding an anonymous type to the DataSource of a radDropDownList and getting an interesting (if unwanted) result. After the binding the first value in the list is selected (which is good), however, the text instead shows the prototyping for the anonymous type. I feel this is best to show in code, so here's an example.
If I'm doing something wrong please let me know. Update() and Refresh() didn't seem to fix the issue.
Thanks,
-Al
My apologies if this has already been posted - I swear I couldn't find it.
Using the Q3 2011 controlls (2011.3.11.1116):
I'm binding an anonymous type to the DataSource of a radDropDownList and getting an interesting (if unwanted) result. After the binding the first value in the list is selected (which is good), however, the text instead shows the prototyping for the anonymous type. I feel this is best to show in code, so here's an example.
If I'm doing something wrong please let me know. Update() and Refresh() didn't seem to fix the issue.
Thanks,
-Al
private
class
TestClass
{
public
int
Id {
get
;
set
; }
public
string
NameVal {
get
;
set
; }
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
var testItem1 =
new
TestClass() {Id = 1, NameVal =
"One"
};
var testItem2 =
new
TestClass() {Id = 2, NameVal =
"Two"
};
var test =
new
List<TestClass>() {testItem1, testItem2};
radDropDownList1.BeginUpdate();
radDropDownList1.DataSource = (from TestClass tc
in
test
select
new
{tc.Id, tc.NameVal});
radDropDownList1.DisplayMember =
"NameVal"
;
radDropDownList1.ValueMember =
"Id"
;
radDropDownList1.EndUpdate();
//radDropDownList1.Text = radDropDownList1.SelectedText; //This line is not equal to the following line...
radDropDownList1.Text = radDropDownList1.SelectedItem.Text;
//This line is the fix, comment out to see bug
}