G
Guest
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.Fields.Item("column").Value),Chr(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="SomeDataSource" Runat="Server">
<ItemTemplate>
<%# Databinder.Eval(Container.DataItem, "SomeField").Replace("\n",
"<br>")%>
</ItemTemplate>
</asp:Repeater>
But that does not work. I keep on getting an error that says 'Replace'
associated with the object 'Whateverpage.aspx'
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-
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.Fields.Item("column").Value),Chr(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="SomeDataSource" Runat="Server">
<ItemTemplate>
<%# Databinder.Eval(Container.DataItem, "SomeField").Replace("\n",
"<br>")%>
</ItemTemplate>
</asp:Repeater>
But that does not work. I keep on getting an error that says 'Replace'
associated with the object 'Whateverpage.aspx'
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-