Facebook Twitter Gplus LinkedIn YouTube Google Maps RSS
Home Technical Formatting Gridview Header
formats

Formatting Gridview Header

|    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>

 
Tags: ,
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

12,871 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© All rights reserved to Cyberbrutus. 2012
credit

Switch to our mobile site