G
Guest
I am using a c# utility to create a Java function on our web pages. I am
utilizing an object we created to retrieve a comment field from our SQL
database and have the system throw the desired alert when a particular option
is selected. The comment is stored in a Text field on our SQL server.
My problem is that, when I apply the value to the alert, the Java Script
throws and unterminated string constant when the page is run if and only if
the comment field contains CrLf in it's value.
I am using .replace(VBCrLf," \n ") from my ASP code behind to display create
an alert on loadup of the page if the current selected value has an alert
comment associated with it. However I can not seem to create an c#
counterpart in my utility
I have tried the following code
char cr = (char)13;
char lf = (char)10;
string cl = cr.tostring() + lf.tostring();
comment.replace(cl.tostring(), " \n ")
or
comment.replace(cr.tostring(),"").replace(lf.tostring()," \n ")
while both of these options process without error and create my javascript
function they do not seem to identify the CrLf characters and replace them
with my desired java escape values.
I know I can get around the issue by putting the code in our asp code behind
but then we won't be able to reutilize it as easily on other pages.
We are trying to standardize our utilities in c#.
I would prefer not to have to create separate SQL query statements to have
SQL handle the replacement.
What do I need to do to create a successful C# equivalent to VB's
comment.replace(vbCrLf, " \n ")
Any help would be greatly appreciated.
Eli Silverman
utilizing an object we created to retrieve a comment field from our SQL
database and have the system throw the desired alert when a particular option
is selected. The comment is stored in a Text field on our SQL server.
My problem is that, when I apply the value to the alert, the Java Script
throws and unterminated string constant when the page is run if and only if
the comment field contains CrLf in it's value.
I am using .replace(VBCrLf," \n ") from my ASP code behind to display create
an alert on loadup of the page if the current selected value has an alert
comment associated with it. However I can not seem to create an c#
counterpart in my utility
I have tried the following code
char cr = (char)13;
char lf = (char)10;
string cl = cr.tostring() + lf.tostring();
comment.replace(cl.tostring(), " \n ")
or
comment.replace(cr.tostring(),"").replace(lf.tostring()," \n ")
while both of these options process without error and create my javascript
function they do not seem to identify the CrLf characters and replace them
with my desired java escape values.
I know I can get around the issue by putting the code in our asp code behind
but then we won't be able to reutilize it as easily on other pages.
We are trying to standardize our utilities in c#.
I would prefer not to have to create separate SQL query statements to have
SQL handle the replacement.
What do I need to do to create a successful C# equivalent to VB's
comment.replace(vbCrLf, " \n ")
Any help would be greatly appreciated.
Eli Silverman