Wednesday, June 30, 2004

About Column Types in Data Grids












Column Types in Data Grids


A DataGrid control is formed by data bound columns. The control has
the ability to automatically generate columns that are based on the
structure of the data source. Auto-generation is the default behavior,
but you can manipulate that behavior by using a Boolean property named
AutoGenerateColumns. Set the property to false when you want the
control to display only the columns you explicitly add to the Columns
collection. Set it to true (the default) when you want the control to
add as many columns as is required by the data source. The default
algorithm for column generation creates simple data bound columns that
use literal controls to display the contents of the corresponding data
source fields. The DataGrid control supports additional column types
that can render the column data so that it performs an action when
clicked.



BoundColumn


Displays a column that is bound to a field in a data source. It displays each item in the field as plain text.


ButtonColumn


Displays a command button for each item in the column. The text of
the button can be data bound. The command name of the button must be
common to all items in the column. When the value for the command name
is Select, clicking the column button automatically selects the row.


EditCommandColumn


Displays a button column that is automatically associated with the
Edit command. This class receives special support from the DataGrid
control, which is manifested as a redrawing of the clicked row using a
template.


HyperLinkColumn


Displays the contents of each item in the column as a link. The link
text can be bound to a field in the data source, or it can be static
text. Also, the target URL can be data bound. Clicking a link column
causes the browser to jump to the specified URL. This column class
supports target frames.


TemplateColumn


Displays each item in the column according to a specified template, allowing you to provide custom controls in the column.


Regards

Mitesh






No comments: