[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Parsing table field Names for Display.. See below, makes more sense

Hi Guru's, I have a database and all of the field names (i.e. CustomerId, ProductId, ThisField, AndThat, ...)
I would like to return these in my grid headers as Customer Id, Product Id, This Field, And That
Grid would look like:
Customer Id |  Product Id | This Field | And That
1                    2                 asdf           dff
3                    5                 asdf           dff
7                    2                 asdf           dff

Has anybody ever done this?
0
joshcrosby
Asked:
joshcrosby
1 Solution
 
TheAvengerCommented:
If you have the field name, you can try something like:

string originalName = "CustomerId";
string readableName = "";

foreach (char ch in originalName) {
  if (ch == Char.ToUpper(ch))
    readableName += " ";
  readableName += ch;
}
0
 
joshcrosbyAuthor Commented:
Thanks TheAvenger
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now