Hi,
Do you have any more concerns on how to set datagrid table style in web
form programming? I found some further information for you:
--------------------------------------
You can further customize the appearance of the DataGrid control by
programmatically adding attributes to the <td> and <tr> tags generated by
the DataGrid control. Attributes can be inserted into the tags by providing
a custom event handler for the ItemCreated or ItemDataBound event. In
general, attributes are added in the event handler for the ItemCreated
event. However, if the attributes depend on actual data, add the attributes
in the handler for the ItemDataBound event.
To add an attribute to the <td> tag, first get the TableCell object that
represents the cell in the DataGrid control to which you want to add the
attribute. The Control.Controls collection for the Item property
(DataGridItemEventArgs indexer) of the DataGridItemEventArgs passed into
the event handler can be used to get the desired TableCell. You can then
use the AttributeCollection.Add method of the Attributes collection for the
TableCell to add attributes to the <td> tag.
To add an attribute to the <tr> tag, first get the DataGridItem that
represents the row in the DataGrid control to which you want to add the
attribute. The Item property (DataGridItemEventArgs indexer) of the
DataGridItemEventArgs passed into the event handler can be used to get the
desired DataGridItem. You can then use the AttributeCollection.Add method
of the Attributes collection for the DataGridItem to add attributes to the
<tr> tag.
--------------------------------------
If there is anything unclear, please feel free to post here. Thanks very
much.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.