1
嗨 我想使用ASP.NET多行文本框向數據庫提交一些信息。 我有以下代碼:ASP.NET替換換行符HTML br不工作
Dim noteContent As String = Replace(txtNoteContent.InnerText.ToString(), vbCrLf, "<br />")
Shop.Job.Notes.addNote(Request.QueryString("JobID"), ddlNoteFrom.SelectedValue, ddlNoteTo.SelectedValue, noteContent)
的addNote的功能代碼爲:
Public Shared Sub addNote(ByVal JobID As Integer, ByVal NoteFrom As Integer, ByVal NoteTo As Object, ByVal NoteContent As String)
Dim newNote As New Job_Note
newNote.Date = DateTime.Now()
newNote.JobID = JobID
newNote.NoteByStaffID = NoteFrom
If Not NoteTo = Nothing Then
newNote.NoteToStaffID = CInt(NoteTo)
End If
newNote.NoteContent = NoteContent
Try
db.Job_Notes.InsertOnSubmit(newNote)
db.SubmitChanges()
Catch ex As Exception
End Try
End Sub
當提交的編譯器似乎並沒有檢測到換行已輸入到文本框中。我已經調試過了代碼,確實,它只是忽略了換行符。如果我嘗試替換另一個字符而不是換行符,它可以正常工作。
它似乎沒有任何與我的功能,LINQ插入或類似的東西,它只是不檢測換行符。我嘗試過VbCr,也嘗試過(13),但他們也不工作。
有人可以幫助我嗎?我一直在嘗試廣告搜索超過一個小時,試圖對此進行分類。
感謝
非常感謝!似乎不同的角色工作。我會確保我記得這一個!再次感謝。 – StrattonL 2011-03-15 00:55:27
沒問題!很高興它的工作。 – 2011-03-15 00:56:08