DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 01 Aug 2007 13:57:32 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Bazza Formez
          2    Alexey Smirnov
          3    Bazza Formez


Keeping text control characters (line breaks / carriage returns) in DetailsView field   
I have a bound field in a DetailsView control that displays free form
description type data from my SQL database table (typical data is a
couple of paragraphs of written product description being held in a
single database field of type ntext).

This description data typically has various simple control characters
in it - ie. new line, carriage returns etc) to make the paragraph more
readable.

My problem is that these control characters are lost / don't work....
When I run the application all text in the field displays as a simple
lump of text.. without any new lines etc.

Below is the simple definition I am using inside the DetailsView..

<asp:BoundField DataField="Description" HeaderText="Description"
SortExpression="Description" />

Can anyone suggest a solution ?

Thanks,
Bazza
Date:Wed, 01 Aug 2007 13:57:32 -0700   Author:  

Re: Keeping text control characters (line breaks / carriage returns) in DetailsView field   
On Aug 1, 10:57 pm, Bazza Formez  wrote:

> I have a bound field in a DetailsView control that displays free form
> description type data from my SQL database table (typical data is a
> couple of paragraphs of written product description being held in a
> single database field of type ntext).
>
> This description data typically has various simple control characters
> in it - ie. new line, carriage returns etc) to make the paragraph more
> readable.
>
> My problem is that these control characters are lost / don't work....
> When I run the application all text in the field displays as a simple
> lump of text.. without any new lines etc.
>
> Below is the simple definition I am using inside the DetailsView..
>
> <asp:BoundField DataField="Description" HeaderText="Description"
> SortExpression="Description" />
>


instead of BoundField use a TemplateField

<asp:TemplateField>
<ItemTemplate>
<%# Replace(Container.DataItem("Description"), vbCrLf, "<br>") %>
</ItemTemplate>
</asp:TemplateField>

and in C# use

Replace("\n", "<br>");
Date:Wed, 01 Aug 2007 14:24:31 -0700   Author:  

Re: Keeping text control characters (line breaks / carriage returns) in DetailsView field   
On Aug 2, 9:24 am, Alexey Smirnov  wrote:

> On Aug 1, 10:57 pm,BazzaFormez wrote:
>
>
>
>
>
> > I have a bound field in a DetailsView control that displays free form
> > description type data from my SQL database table (typical data is a
> > couple of paragraphs of written product description being held in a
> > single database field of type ntext).
>
> > This description data typically has various simple control characters
> > in it - ie. new line, carriage returns etc) to make the paragraph more
> > readable.
>
> > My problem is that these control characters are lost / don't work....
> > When I run the application all text in the field displays as a simple
> > lump of text.. without any new lines etc.
>
> > Below is the simple definition I am using inside the DetailsView..
>
> > <asp:BoundField DataField="Description" HeaderText="Description"
> > SortExpression="Description" />
>
> instead of BoundField use a TemplateField
>
> <asp:TemplateField>
> <ItemTemplate>
> <%# Replace(Container.DataItem("Description"), vbCrLf, "<br>") %>
> </ItemTemplate>
> </asp:TemplateField>
>
> and in C# use
>
> Replace("\n", "<br>");- Hide quoted text -
>
> - Show quoted text -


Thank you very much Alexey!
Date:Mon, 06 Aug 2007 13:53:11 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us