Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid Column Heading HTML Encoding ?

Reply
Thread Tools

DataGrid Column Heading HTML Encoding ?

 
 
Adrian Parker
Guest
Posts: n/a
 
      02-27-2006
Can someone tell me how to be able to force line breaks in a datagrid column
heading? If the text contains "abc<br>def" then that is what comes out;
the source view contains the "abc&lt;br&gt;def". I'll assume that this
isn't just a problem with datagrid column headings, so is there a generic
solution ?
--
Adrian Parker
Ingenuity At Work Ltd


 
Reply With Quote
 
 
 
 
Erik Funkenbusch
Guest
Posts: n/a
 
      02-27-2006
On Mon, 27 Feb 2006 13:09:20 -0000, Adrian Parker wrote:

> Can someone tell me how to be able to force line breaks in a datagrid column
> heading? If the text contains "abc<br>def" then that is what comes out;
> the source view contains the "abc&lt;br&gt;def". I'll assume that this
> isn't just a problem with datagrid column headings, so is there a generic
> solution ?


The easiest solution is to just go into your aspx page in code view and
change the header text. remember to add the closing /> to make it xhtml
compliant.
 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-28-2006
Hi Adrian,

Are you using ASP.NET 1.1 or ASP.NET 2.0. I've just tried using the
DataGrid in ASP.NET 2.0 page with some html element like <br/> in the
BoundColumn's HeaderText and it can works. Also, I think you can consider
using TemplateColumn since it can let us customize the Header by inputing
discretionary html content in the HeaderTemplate.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
Adrian Parker
Guest
Posts: n/a
 
      02-28-2006
Hi Steven,

Just found the solution.. We're using 2.0 and we were already using a
templare which inherits from BoundField.

What we needed to do was to add the following to the template properties:-

Protected Overrides ReadOnly Property SupportsHtmlEncode() As Boolean
Get
Return False
End Get
End Property

Then the html is rendered as expected.

--
Adrian Parker
Ingenuity At Work Ltd

"Steven Cheng[MSFT]" <> wrote in message
news:i$...
> Hi Adrian,
>
> Are you using ASP.NET 1.1 or ASP.NET 2.0. I've just tried using the
> DataGrid in ASP.NET 2.0 page with some html element like <br/> in the
> BoundColumn's HeaderText and it can works. Also, I think you can consider
> using TemplateColumn since it can let us customize the Header by inputing
> discretionary html content in the HeaderTemplate.
>
> Hope this helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-01-2006
That's cool Adrian,

Thanks for your followup and share the solution with us.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match width of column heading in row with GridView BoundFields in JB ASP .Net 3 10-21-2009 05:05 PM
How to align column heading in html table with JB ASP .Net 1 10-21-2009 06:25 AM
Can 2 columns of a DataGrid have a single heading OR can I have two controls in 1 column? mark4asp ASP .Net 2 11-11-2006 02:13 AM
GridView ASP.NET 2.0 Column Heading Justification dm1608 ASP .Net 1 02-19-2006 09:33 AM
Underline Hyperlink Column Heading Only Alan Z. Scharf ASP .Net Datagrid Control 2 12-17-2004 03:36 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57