mountainbiking
02-08-2007, 06:24 AM
This should be an easy one....
I have many labels in a FormView one of the labels I want to replace the whitespace (vbcrlf) with <br> to get proper formatting as the user initially entered into a textarea.
The string tha I had in Classic ASP is this:
<%= Replace(adoRs("Description"),vbCrLf, "<br>")%>
This works great, I am not having luck with getting my label formatted as such. It could be that I am placing the code against the wrong event within the FormView or something else that I may totally be missing.
Here is what I have and it doesn't work:
Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound
Replace(DirectCast(FormView1.FindControl("DescriptionLabel"), Label).Text, vbCrLf, "<br />")
End Sub
I have also tried the replace line of code inside the load, and itemcommand events of the formview.
I have many labels in a FormView one of the labels I want to replace the whitespace (vbcrlf) with <br> to get proper formatting as the user initially entered into a textarea.
The string tha I had in Classic ASP is this:
<%= Replace(adoRs("Description"),vbCrLf, "<br>")%>
This works great, I am not having luck with getting my label formatted as such. It could be that I am placing the code against the wrong event within the FormView or something else that I may totally be missing.
Here is what I have and it doesn't work:
Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound
Replace(DirectCast(FormView1.FindControl("DescriptionLabel"), Label).Text, vbCrLf, "<br />")
End Sub
I have also tried the replace line of code inside the load, and itemcommand events of the formview.