473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DataGrid Column Heading HTML Encoding ?

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
Feb 27 '06 #1
4 1822
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.
Feb 27 '06 #2
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.)

Feb 28 '06 #3
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]" <st*****@online.microsoft.com> wrote in message
news:i$**************@TK2MSFTNGXA03.phx.gbl...
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

Feb 28 '06 #4
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.)

Mar 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Simon | last post by:
Can any one please tell me how to set the width of my datagrid coloums after I have put them into edit mode? At the moment I bind the datagrid to a returning dataset; DataGrid1.DataSource =...
4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
10
by: Robert Schuldenfrei | last post by:
Hi NG: I have the following code working. The GetProdStrtList() returns a DataTable called psTable. A Grid control is successfully bound to this table and displays correctly. I would like to...
5
by: AC | last post by:
Any reason i'm having trouble with: DataGrid1.Columns(7).ItemStyle.HorizontalAlign = HorizontalAlign.Right I'm trying to directly set the column alignment of a datagrid created at runtime.. ...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
10
by: Alan Lambert | last post by:
I am writing a web-based reporting tool and using a datagrid to display information returned from a database. I am displaying column headings from bound columns with no problems but I need to...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
2
by: mark4asp | last post by:
This page is currently using a Repeater control to create a table with 6 columns. The first column has 2 ImageButton controls and a common header. How can I do this with a DataGrid ? I need...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.