The "CSS Class Layout" tool in the "Table Properties" dialog
It is a common scenario to style a table with CSS classes for increased clarity and visual appeal. Manually setting class name to each individual cell and row is a slow and tedious task.
The "CSS Class Layout" tool available in the "Table Properties" dialog makes the task real easy by allowing the user to style a new, or existing tables completely by choosing a table layout form a drop down (similar to visual studio design time). The "CSS Class Layout" tool contains a number of built in layouts. If a user chooses one, a style tag is inserted to the edited content.
In addition to this, developers can also specify their own style sheet files which fit better the layout of their applications. The external Style sheet can be edit by using the TableLayoutCssFile property of the RadEditor. In this case the editor will not insert a style tag in to its content area, so one would need to make sure that this external style sheet file is also imported in the page where the edited content will be displayed. In the custom css file can be inserted multiple table CSS layouts. Each layout consists of number of CSS style classes following certain naming conventions.
For example, here is how a table layout should be constructed. There is one main class (myClass) that will be applied on the table. All other classes should contain the name of the main class plus a respective suffix (for example: myClassTableHeaderRow).
These are the classes for a layout with main class myClass:
Relevant CSS Selectors
Table class
.myClassTable {}
Table Header classes
.myClassTable tr.myClassTableHeaderRow {}
.myClassTable td.myClassTableHeaderFirstCol {}
.myClassTable td.myClassTableHeaderLastCol {}
.myClassTable td.myClassTableHeaderOddCol {}
.myClassTable td.myClassTableHeaderEvenCol {}
Table Body classes
.myClassTable tr.myClassTableOddRow {}
.myClassTable tr.myClassTableEvenRow {}
.myClassTable td.myClassTableFirstCol {}
.myClassTable td.myClassTableLastCol {}
.myClassTable td.myClassTableOddCol {}
.myClassTable td.myClassTableEvenCol {}
Table Footer classes
.myClassTable tr.myClassTableFooterRow {}
.myClassTable td.myClassTableFooterFirstCol {}
.myClassTable td.myClassTableFooterLastCol {}
.myClassTable td.myClassTableFooterOddCol {}
.myClassTable td.myClassTableFooterEvenCol {}
You can also examine how the TableLayoutCss.css file, used in this demo is created.