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

Use DataTable in DataSourcs

1 Answer 116 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 2
Robert asked on 25 Jul 2013, 11:02 PM
I try add sourse to DropDownList, but this dosn't return result...
Object r is List<CultureInfo>
           
DataTable dtLangs = new DataTable();
dtLangs.Columns.AddRange(new DataColumn[] {new DataColumn("ID"), new DataColumn("Name")} );
AppSetting.Instance.Languages.Select( r => dtLangs.Rows.Add(r.TwoLetterISOLanguageName, r.DisplayName));
 
this.ddlLanguage.DataSource = dtLangs;
this.ddlLanguage.DisplayMember = "Name";
this.ddlLanguage.ValueMember = "ID";

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Jul 2013, 03:44 PM
Hi Robert,

Your lambda expression does not add any rows to the DataTable. I have added the rows manually and the RadDropDownList is successfully displaying the languages. Using your code I have created and attached sample project. In the sample I am manually populating your data table with all the languages that current machine have.

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DropDownList
Asked by
Robert
Top achievements
Rank 2
Answers by
Dimitar
Telerik team
Share this question
or