displaying related table data

6 posts, 0 answers
  1. Will Ferguson
    Will Ferguson avatar
    40 posts
    Member since:
    Aug 2009

    Posted 29 Apr 2010 Link to this post

    I know this is a basic question. I just can't find the answer. Please poiunt me in the right direction

    i have 2 tables
    Customer and towms

    how do I get the townName to display in a datagrid view rather thatn the TownID

    you now what I mean. I don't want to see townID  but TownName (from the towns table)
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 29 Apr 2010 Link to this post

    Hello Will Ferguson,

    The right way to achieve this is to use the proper view model and feed it to RadGridView e.g. do not bind to data directly , but use a proxy object to translate IDs to descriptions and bind the RadGridView to this proxy object.

    Another way:
    However you might harness RadGridView to do this for you.You may use the GridViewComboBoxColumn -  it has a separate ItemsSource , so you can feed it with a List of towns , set the TownName as DisplayMemberPath, set the TownID as SelectedValuePath and set the DataMemberBinding to the ID in your master table.
    The column will then translate the IDs to Names for you .
    In Display mode it will show a text with the translated name, and in edit mode it will show a combobox editor. You might disable the edit mode if you do not need it in your scenario.

    All the best,
    Pavel Pavlov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Will Ferguson
    Will Ferguson avatar
    40 posts
    Member since:
    Aug 2009

    Posted 30 Apr 2010 Link to this post

    Ok Yes I would like to do this the Best way.

    I have an Edmx Entity model. In another tier.

    Is there a walkthrough for me on the matter of displaying heirarchical data.
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 03 May 2010 Link to this post

    Hi Will,

    To point you in the right direction , I will need to know  a bit more - would the cell displaying the Town be editable ? In other words is it read-only , or the user should be capable of selecting a new Town ?

    Regards,
    Pavel Pavlov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Will Ferguson
    Will Ferguson avatar
    40 posts
    Member since:
    Aug 2009

    Posted 03 May 2010 Link to this post

    The town Field would not need to be editable. At most I may consider a combo box. ( a list of town names). But fo rnow I think it's best as a readonly . I'll do my editing on another "form"
  7. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 04 May 2010 Link to this post

    Hi Will Ferguson,

    The attached sample demonstrates the simpliest possible solution with RadGridView.

    It has a Locations datatable which stores the TownID.
    There is a second datatable with Towns .
    RadGridView is set up with a GridViewComboBoxColumn to translate the town IDs to Names.


    Kind regards,
    Pavel Pavlov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for WPF is Visual Studio 2017 Ready