list of complex objects as datasource

3 posts, 1 answers
  1. ted
    ted avatar
    2 posts
    Member since:
    Aug 2011

    Posted 23 Aug 2011 Link to this post

    I want to try and use a list of objects as my data source where the object contains multiple fields and I am populating the listbox programmatically.  If I set the Datasource of my list box to the object how can I set what fields actually show up in the listbox I tried using templates but I couldn't get that to work.

    List<Keyword> resultList = keywordService.FindKeywords();
                canonicalSearchResults.DataSource = resultList;
                canonicalSearchResults.DataBind();

    I want the Keyword's name field to appear in the textbox but be able to keep the datasource as a list of keywords so that I can later access them. Right now it calls the tostring method and displays the result but the toString method is different than what I want displayed
  2. Answer
    Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 26 Aug 2011 Link to this post

    Hello Ted,

    Please review the following resources: demo for declarative datasource binding and the attached project(example with templates).

    All the best,
    Peter Filipov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ted
    ted avatar
    2 posts
    Member since:
    Aug 2011

    Posted 26 Aug 2011 Link to this post

    Thanks I just needed to know the right place to look
Back to Top