Wednesday, November 29, 2006

HeaderImageUrl overwrites HeaderText

If you set up HeaderImageUrl property in HyperLinkColumn, the text from HeaderText will not be shown.
Take this code for example:

<asp:HyperLinkColumn DataTextField="urn:schemas-microsoft-com:office:office#Author"
DataNavigateUrlField="urn:schemas-microsoft-com:office:office#Author"
DataNavigateUrlFormatString="/MySite/Public.aspx?user={0}"
HeaderText="Author" HeaderImageUrl="/_layouts/images/imnhdr.gif">


The "Author" text will not be shown in this column's header. Only the icon will be visible. Well there is a simple way to solve

this:


<asp:HyperLinkColumn DataTextField="urn:schemas-microsoft-com:office:office#Author"
DataNavigateUrlField="urn:schemas-microsoft-com:office:office#Author"
DataNavigateUrlFormatString="/MySite/Public.aspx?user={0}"
HeaderText="<img src='/_layouts/images/imnhdr.gif'/>Author">


hey, it works :-)

No comments: