Greetings!
I'm still learning about the GridView control and I have one bound to an ObjectDataSource. My Web form looks like this:
<asp:GridView ID="ourGrid" runat="server" DataSourceID="ourDataSource" onrowdatabound="ourGrid_RowDataBound"
HeaderStyle-CssClass="header_style" AlternatingRowStyle-CssClass="altrow_style"
ShowFooter="true">
<columns>
<asp:BoundField DataField="Name" HeaderText="Full Name" />
<asp:BoundField DataField="Gender" HeaderText="Gender" />
<asp:BoundField DataField="BirthYear" HeaderText="Year of Birth" />
<asp:BoundField DataField="JoinDate" HeaderText="Date Joined" HtmlEncode="false" DataFormatString="{0:d}" />
</columns>
</asp:GridView>
<asp:ObjectDataSource ID="ourDataSource" runat="server" SelectMethod="GetTopUsers" TypeName="Acme.Model.OurNewObject">
</asp:ObjectDataSource>
It currently generates the following markup:
<table cellpadding="0" cellspacing="0" summary="">
<thead>
<tr style="header_style">
<th scope="col">Full Name</th>
<th scope="col">Gender</th>
<th scope="col">Year of Birth</th>
<th scope="col">Date Joined</th>
</tr>
</thead>
<tfoot>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Smith</td>
<td>Male</td>
<td>1967</td>
<td>17-6-2007</td>
</tr>
<tr class="AspNet-GridView-Alternate altrow_style">
<td>Mary Kay</td>
<td>Female</td>
<td>1972</td>
<td>15-11-2007</td>
</tr>
<tr>
<td>Bill Jones</td>
<td>Male</td>
<td>1970</td>
<td>23-2-2007</td>
</tr>
</tbody>
</table>
There are a few more HTML elements that I'd like to add to the table markup that this GridView control will generate. For starters, I need the TFOOT to look like this:
<tfoot>
<tr>
<td colspan="4">
<div>
<a class="footerlink_style" title="Newest Members" href="#">Newest Members</a>
<a class="footerlink_style" title="Top Posters" href="#">Top Posters</a>
</div>
</td>
</tr>
</tfoot>
The links will not contain databound information, but will likely be Hyperlink controls. Is there a way I can specify this at design-time?
Also, for the THEAD, is it possible to specify separate styles for each column header like this in the GridView?
<thead>
<tr style="header_style">
<th scope="col" style="col1_style">Full Name</th>
<th scope="col" style="col2_style">Gender</th>
<th scope="col" style="col3_style">Year of Birth</th>
<th scope="col" style="col4_style">Date Joined</th>
</tr>
</thead>
Finally, is it possible to specifiy the summary attribute of the table like this?
<table cellpadding="0" cellspacing="0" summary="Here is a list of users">
Thanks in advance.