10033 : Id like to put my own labels inside the headers of each column.

Question

Id like to put my own labels inside the headers of each column.
Is this possible?  How?

Thanks.

 

Answer

When you define you columns you set the Title property;

            GridColumn c_st=gantt1.Grid.Columns.AddNew(CellType.SingleText);
            GridColumn c_mt=gantt1.Grid.Columns.AddNew(CellType.MultiText);
            GridColumn c_td=gantt1.Grid.Columns.AddNew(CellType.TimeDate);

            c_st.Title=“SingleText”;
            c_mt.Title=“MultiText”;
            c_td.Title=“TimeDate”;

You can then control how the column headers are rendered by assigning CellLayouts. The simple way to assign a named CellLayout to the complete column is to set the gantt1.Grid.Columns.LayoutName to the name of an existing CellLayout in the Gantt.Grid.CellLayouts collection.

A more advanced way, that allows you to have unique CellLayouts all cells, including header cells, is to in runtime assign a CellLayout object the the Cell.Layout property. For header cells you reach the cell object via the Column object; GridColumn.ColumnCell.

You can also inject html code in the headers or in any cell by assigning them values with html snippets in them; like instead of col.Title=”the title” you can set col.Title=”<b>the title</b>”…

 

 

Leave a Reply