473,547 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Carriage Returns

In ASP using VBScript to replace Chr(13) or Chr(10) with a <br> tag I would
use the Replace method so that I can catch carriage returns from a memo field
in MS Access or a Text field in MS SQL Server. For instance
<%=Replace(rs.F ields.Item("col umn").Value),Ch r(13),"<br />")%>. I am, now,
migrating to ASP.NET 1.1 and am using C# as the primary programming language.
In one of my contracts I have a database table with a field that must be a
text field in SQL Server that must hold carriage returns which does not
convert to <br> when I serve up the data field. The table in the database
that holds the text field is a child table of another table. I need to be
able to convert a new line "\n" to the HTML equivalent "<br />"
programatically . Nothing I have done has worked. So far I have tried:

<asp:Repeater ID="SomeDataSou rce" Runat="Server">
<ItemTemplate >
<%# Databinder.Eval (Container.Data Item, "SomeField").Re place("\n",
"<br>")%>
</ItemTemplate>
</asp:Repeater>
But that does not work. I keep on getting an error that says 'Replace'
associated with the object 'Whateverpage.a spx'
or I get an error that states something to the effect that a method was
expected but got a property-- something like that error-- the meaning is the
same. Whatever the case I think I'm getting something wrong.

If anyone can tell me where I am going wrong I would greatly appreciate it.

Thank you,

Sam-
Nov 18 '05 #1
1 2660
Hello I am Sam" I am,

You probably need to cast from the object to a string...

try something like this (untested): <%# ((string)DataBi nder.Eval(Conta iner.DataItem, "SomeField")).R eplace("\n", "<br>"); %>

--
Matt Berther
http://www.mattberther.com
In ASP using VBScript to replace Chr(13) or Chr(10) with a <br> tag I
would
use the Replace method so that I can catch carriage returns from a
memo field
in MS Access or a Text field in MS SQL Server. For instance
<%=Replace(rs.F ields.Item("col umn").Value),Ch r(13),"<br />")%>. I am,
now,
migrating to ASP.NET 1.1 and am using C# as the primary programming
language.
In one of my contracts I have a database table with a field that must
be a
text field in SQL Server that must hold carriage returns which does
not
convert to <br> when I serve up the data field. The table in the
database that holds the text field is a child table of another table.
I need to be able to convert a new line "\n" to the HTML equivalent
"<br />" programatically . Nothing I have done has worked. So far I
have tried:

<asp:Repeater ID="SomeDataSou rce" Runat="Server">
<ItemTemplate >
<%# Databinder.Eval (Container.Data Item,
"SomeField").Re place("\n",
"<br>")%>
</ItemTemplate>
</asp:Repeater>
But that does not work. I keep on getting an error that says
'Replace'
associated with the object 'Whateverpage.a spx'
or I get an error that states something to the effect that a method
was
expected but got a property-- something like that error-- the meaning
is the
same. Whatever the case I think I'm getting something wrong.
If anyone can tell me where I am going wrong I would greatly
appreciate it.

Thank you,

Sam-


Nov 18 '05 #2

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

Similar topics

4
7311
by: Les Juby | last post by:
Can someone please help with a suggestion as to how I can keep the formatting (carriage returns) that the user enters into a memo field and then display that later. I figured I might be able to use: 'replace carriage returns with BRs comment=Replace(comment, chr(13), "<br>") but obviously net.! The <pre> tag doesn't sem to help either...
2
4116
by: Andrew Chanter | last post by:
I have a VBA function that returns a string including "vbcr" (VB Carriage Return) to seperate a list into multiple rows, eg Item1 & vbcr & Item2 & vbcr & Item3 This works as planned in the immediate window, producing a list where a Carriage Return follows each item. But when I output the result into either an Access query or form, instead...
2
2933
by: eagleofjade | last post by:
I am trying to import data from a Word document into an Access table with VBA. The Word document is a form which has various fields. One of the fields is a field for notes. In some cases, this note field contains carriage returns. When I import a note field that has carriage returns, what shows up in the Access field are vertical black...
12
5594
by: Nimmy | last post by:
Hi, I have a data file and I want to remove Carriage returns. Any one has any C code/program which does this? I am working on Windows XP machine.....I don't have access to UNIX machine. But I need to send this data file to the Unix machine once I remove the carriage retunrns from my XP machine. Thanks
2
2321
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost when pulling data from an SQL database. The thing that frustrates me the most, is that when I use Enterprise Manager, the carriage returns ARE...
8
2211
by: TheDude5B | last post by:
Hi, I have some data which is stored in my MySQL database as TEXT. when the data is entered in, it has some carriage returns in it, and this can be seen when querying the data using MySQL Query Browser. I want to then display this text within <p> tags when requested from the database. However, the test is formatted without the carriage...
7
11170
by: mattrapoport | last post by:
I have a page with a div on it. The div displays a user comment. When the user logs into this page, their current comment is pulled from a db and displayed in the div. The user can edit the comment through a pop-up that contains a textarea. When the user hits OK on the pop-up, the text in the textarea is sent to a function on the main...
2
4640
by: GregBeagle | last post by:
Windows XP I have a simple form from which I want to generate an email with the contents of the form. I use carriage returns to format the content for readability. When I test it on my computer the email generated by getURL("mailto..") is fine in my email client. Carriage returns are kept etc and shows how I want it. However when I upload...
0
1398
by: markus.shure | last post by:
Hi, I'm noticed a problem testing a JAX-WS client with a WSE server. The JAX-WS client adds carriage returns to a SOAP header element that is signed. This causes the WSE server to raise an error: "The signature or decryption failed". If the carriage returns are removed, the same web service call is successful. I tried replicating the...
11
12568
by: evenlater | last post by:
My db allows the user to send email via CDO. The body of the email is determined in code. I have built an email form with To, CC and Subject lines and a large text box for the body of the message so the user can edit the default email message body before sending the message. But when I populate the large text box (txtBody), I can't get it to...
0
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7703
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7463
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7797
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6032
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1923
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.