Ask a Question related to ASP.NET General, Design and Development.
-
crjunk #1
Prevent 'Chr(13) + Chr(10)' from Being Executed in String
I have the following code in my web page.
Dim tmpReplace As String
'Giving tmpReplace the value from the textbox on the
webform.
tmpReplace = txtComments.Text.Trim
'Prevents report from crashing when a single quote is in
string
tmpReplace = tmpReplace.Replace("'", "''")
'Replace carriage return with the appropriate CharCodes.
tmpReplace = tmpReplace.Replace("\n", "chr(13) + chr(10)")
I want to display the following text on my report: chr(13) + chr(10)
Instead what is happening is that .Net is executing the chr function
and creating a carriage return. What do I need to do to prevent the
chr function from being launched?
crjunk Guest
-
Can a .as be executed in CF8
IIRC you can use the import and #include directives using cfformitem type="script" and/or cfsavecontent. Though I do not know if either is... -
a different web.config gets executed
I have .Text running on a Windows 2003 Server website, and a WebService project running on the same website, but in a virtual directory created... -
hoe to prevent a control from being executed
I have 2 controls on this page as shown below. The first is a datalist control which contains links to the particular image gallery (second... -
aspnet_wp won't get executed
Hi folks.. I installed windows server 2003 with domain controller role. And installed iis6 and .net framework etc. I run aspnet_regiis -i for... -
how to prevent prevent .so-calling routine to crash from segfaults in .so
Hi, Guys I am stuck with a problem and need some help. Platform : Linux(RedHat 7.3) Problem Area : Dynamic Shared Object Libraries, POSIX... -
Michal A. Valasek #2
Re: Prevent 'Chr(13) + Chr(10)' from Being Executed in String
| tmpReplace = tmpReplace.Replace("'", "''")
| 'Replace carriage return with the appropriate CharCodes.
| tmpReplace = tmpReplace.Replace("\n", "chr(13) + chr(10)")
|
| I want to display the following text on my report: chr(13) + chr(10)
| Instead what is happening is that .Net is executing the chr function
| and creating a carriage return. What do I need to do to prevent the
| chr function from being launched?
It's not executing the Chr function. "\n" is not special character i VB.NET.
If you want to replace CRLF, use:
tmpReplace = tmpReplace.Replace(vbCrLf, "chr(13) + chr(10)")
But if you're doing this only for storing in database, use parameters
instead and everything - quotes, line ends etc. - would be escaped
automatically.
--
Michal A. Valasek, Altair Communications, [url]http://www.altaircom.net[/url]
Please do not reply to this e-mail, for contact see [url]http://www.rider.cz[/url]
Michal A. Valasek Guest
-
crjunk #3
Re: Prevent 'Chr(13) + Chr(10)' from Being Executed in String
I removed the "\n" from the code. The example I was using to go by
said this would remove the return, but obviously it wont. Here is what
I changed it to.
Here is code from my report options page:
'Setup user's comments in correct format so that it can be
'passed to the comment formula on the report.
Dim tmpReplace As String
tmpReplace = txtComments.Text.Trim
'Replace double quotes in the string with 2 double quotes.
tmpReplace=tmpReplace.Replace(Chr(34), Chr(34) + Chr(34))
'Replace carriage returns & line feed with double quotes &
'text that represents a return and line feed.
tmpReplace = tmpReplace.Replace(Chr(13) + Chr(10), """ +
chr(13) + chr(10) + """)
'Add double quotes to tmpReplace.
tmpReplace = """" + tmpReplace + """"
Session("UComments") = tmpReplace
This allows me to pass the text to my web form that contains my
CrystalReport Viewer. On this page, I have the following text:
oRpt.DataDefinition.FormulaFields.Item("UserCommen ts").Text
= Trim(Session("UComments"))
CrystalReportViewer1.ReportSource = oRpt
By doing this I can pass the value to a blank formula field named
UserComments on my report. Took forever, but I finally got everything
to work.
crjunk Guest



Reply With Quote

