ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.

Advertisements

An Extensive Examination of the PHP:DataGrid Component: Part 2

(Page 1 out of 2)

Welcome to Part 2 of the PHP:DataGrid Examination Series. In the previous part I gave you an introduction to the PHP:DataGrid component, and what it exactly is. I also showed you a small example, demonstrating the component at its simplest.

In this part we're going to have a look at DataGrid styles, and how to customize your datagrids. I am also going to show you how to specify the columns you want to show, using the AutoGenerateColumns property. And finally, at the end of this article I will have another (simple) example, but this time it will also include the things we've learned in this part.

Customizing PHP:DataGrid - Using Styles

To change the appearance of your datagrid, you can use a thing called "Styles". These styles are used to set certain properties, e.g. background color, text color, alignment, etc. There five different kinds of styles:

- Style: this style is used for the main datagrid table
- HeaderStyle: this style is used for the headers
- FooterStyle: this style is used for the footers
- ItemStyle: this style is used for the items
- AlternateItemStyle: this style is used for the alternate items

With these styles you have quite a lot control on how your datagrid should look. An example of using styles to create a better-looking datagrid can be seen below: