table field names vs. display names

Discussion in 'ASP .Net' started by Bob, Jul 30, 2004.

  1. Bob

    Bob Guest

    When displaying data from the database, very often the field names are not
    suitable so custom headings have to be created, For example, the column
    storing zip code may be named zip, but when displayed, it may need to be
    displayed as "Zip", "Postal Code", "Zip/Postal Code" etc. DataGrid/DataList
    allow headings to be created but it's usually hardcoded. And the hardcoding
    is even worse if a row of data is to be displayed in columns, e.g. user
    profile data is usually stored as rows but when editing one user, it's
    usually displayed as a two column table, the first column with headings
    (First Name, Last Name, etc), and the second column input boxes.

    I would very much like to avoid hardcoding the field name to display words
    mapping at all, and wonder how it's usually done. Where do people maintain
    such a mapping and how?

    Thanks for any suggestions.
    Bob
     
    Bob, Jul 30, 2004
    #1
    1. Advertising

  2. Bob

    Lucas Tam Guest

    " Bob" <> wrote in
    news::

    > I would very much like to avoid hardcoding the field name to display
    > words mapping at all, and wonder how it's usually done. Where do
    > people maintain such a mapping and how?


    Have a table call ColumnMappings. In the table you would have:

    TableName
    ColumnNumber (or Name)
    DisplayName

    When you output the data, select from the ColumnMappings Table to get the
    display name.

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Jul 30, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J Sahoo
    Replies:
    3
    Views:
    5,291
    naikpalak
    Apr 30, 2009
  2. Morris Neuman

    Do not display table on form if field is null

    Morris Neuman, Apr 12, 2007, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    161
    Morris Neuman
    Apr 17, 2007
  3. goldtech

    Win32::OLE ADO Table Field names

    goldtech, Dec 23, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    305
    goldtech
    Dec 25, 2007
  4. Sound
    Replies:
    2
    Views:
    452
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    426
Loading...

Share This Page