| A | B C | D E / F |
| A | B | D |
| | C | E / F |
You can do it without templates. Just set HtmlEncode=”False” on the headers with <br /> tags in them.
Example:
<asp:GridView ID=”GridView1″ runat=”server” DataSourceID=”Data”><Columns> <asp:BoundField HeaderText=”First Line<br />Second Line” DataField=”ContactID” HtmlEncode=”False” /> <asp:BoundField HeaderText=”Second” DataField=”FirstName” /> <asp:BoundField HeaderText=”Third<br />Extra” DataField=”Title” /> </Columns></asp:GridView>
If you use a template field, you can have fine grain control the header content in the header template:
<asp:templatefield> <headertemplate> D<br /> E / F </headertemplate> <itemtemplate> <%#Eval(“MyField”)%> </itemtemplate></asp:templatefield>






