Use DataTable in DataSourcs

2 posts, 0 answers
  1. Robert
    Robert avatar
    1 posts
    Member since:
    Jul 2013

    Posted 25 Jul 2013 Link to this post

    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";
  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 30 Jul 2013 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top