AddGridCol(ColName, Position, AllowOrderBy)

Adds a new grid column dynamically to a List block.

The changes don't apply outside the ASP pages they're used in.

Parameters
  • ColName (required). Specifies the name of the field to be added as a column. The field must be relevant to the List block. It must be available in the table or view on which the List block is based.
  • Position (optional). Specifies the position at which to add the column.
    Possible values:
    • <a positive integer>. Specifies the index of the position at which to add the column.
    • 0. Adds the column to the first position.
    • -1 (default). Adds the column to the last position.
  • AllowOrderBy (optional). Specifies if the entries in the column can be sorted.
    Possible values:
    • true. Specifies that the entries cannot be sorted.
    • false (default). Specifies that the entries can be sorted.
Examples

MyList = CRM.GetBlock('CompanyGrid');
MyList.AddGridCol('comp_revenue', -1, true);
CRM.AddContent(MyList.Execute());
Response.Write(CRM.GetPage());

Adds a new column comp_revenue to the end of the company grid list. The entries in the new column can be sorted.