Custom Tables: access value of "field caption" in code

Rita Mikusch asked on June 20, 2017 19:38

Hi,

I'm writing a custom webpart that accesses a custom table. In my c# code I know the table name and a particular "field name" ... how do I use that information to get the "field caption" for that particular "field name"? Would anybody know?

Thank you!

Correct Answer

Peter Mogilnitski answered on June 20, 2017 20:46

If I understand correctly:

    DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo("YourCustomTableClassName");
    if (dci != null)
    {
        FormInfo fi = new FormInfo(dci.ClassFormDefinition);
        FormFieldInfo ffi = fi.GetFormField("FieldName");
        Response.Write(ffi.Caption);
    }
1 votesVote for this answer Unmark Correct answer

Recent Answers


Rita Mikusch answered on June 20, 2017 21:49

Awesome, thank you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.