locked
Displaying Reference Columns (Look Up Table) RRS feed

  • Question

  • User1304403289 posted

    Hi All!

    I am not a programmer, but needed a front-end tool to for my users to maintain a few tables; therefore, I've generated the Dynamic Data Site using VS 2010 and added a few look up tables for my data.

    I have a transaction table, which I joined with the Accounts table using the AccountNumber column.  The account list (reference) table has FirstName, LastName, State, AccountNumber columns. 

    The grid displays only one of the columns - FirstName.  How do I add all of the columns from the reference table (FirstName, LastName, State, AccountNumber) to the grid (for display pursposes only), so users will see Account names and other info, in addition to the account number?

    Furthermore, because the list of accounts is huge, I'd like users to be able to enter the AccountNumber manually (when adding new records), in addition (or replacing) the automatic drop-down.

    Thank you in advance for your help!

    Pasha

    Friday, December 16, 2011 6:27 PM

Answers

All replies

  • User-330204900 posted

    The grid displays only one of the columns - FirstName.  How do I add all of the columns from the reference table (FirstName, LastName, State, AccountNumber) to the grid (for display pursposes only), so users will see Account names and other info, in addition to the account number?

    for this you can use DisplayNameAttribute on the lookup tables metadata, and if you want to display more than 1 column i.e. FirstName + " " + LastName you can do this by adding a partial class to you entities and overriding the ToString method on it see Rick Andersons post here

    Furthermore, because the list of accounts is huge, I'd like users to be able to enter the AccountNumber manually (when adding new records), in addition (or replacing) the automatic drop-down.

    This one is a little more complicated what you want here is instead of selectin from the Accounts FK dropdown list to be able to enter an account number? if so I will have a look that is a good idea for a new field template :)

    Saturday, December 17, 2011 2:27 PM
  • User1304403289 posted

    Thank you, sjnaughton!

    I understand how to display A particular column; however, I wanted to display multiple (separate) columns from the reference table, i.e. FirstName, LastName, State, AND include the actual AccountNumber as well.  I did not want to combine them into one column.

    Thanks,

    Pasha

    Monday, December 19, 2011 6:51 PM
  • User-330204900 posted

    Have a look at  Rick Andersons post Improving the FK field display: Showing two fields in Foreign Key columns

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 19, 2011 8:05 PM
  • User1304403289 posted

    sjnaughton,

    Rick Anderson's post shows how to combine Last Name and First Name columns; whereas, I am trying to display two separate columns - First Name and Last Name....unless I'm reading something wrong :)

    Thanks,

    Pasha

    Monday, December 19, 2011 8:10 PM
  • User-330204900 posted

    Ricks way is the way that works the dropdown list will only display a single column so you have to combine them and the ToString override is the best way.

    Tuesday, December 20, 2011 6:10 AM