I have an ASP TextBox with TextMode installed in MultiLine. I'm having trouble saving vbCrLf characters when the user tries to put lines in text. When the button on the page is clicked, I take the text from the control by trimming it with String.Trim and assigning the String property for the object to this value (which, in turn, assigns it to the private String internal variable of the object). Then the object takes the value from the private internal variable and issues it to the database by calling the stored procedure (the SP parameter in which it is placed is nvarchar (4000)).
ASPX page:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" RenderMode="Inline" UpdateMode="Conditional"
ChildrenAsTriggers="true">
<ContentTemplate>
<asp:TextBox TextMode="MultiLine" runat="server" ID="txtComments" Width="100%" Height="60px" CssClass="TDTextArea" Style="border: 0px;" MaxLength="2000" />
</ContentTemplate>
</asp:UpdatePanel>
code behind:
ProjectRequest.StatusComments = txtComments.Text.Trim
object property:
Protected mStatusComments As String = String.Empty
Property StatusComments() As String
Get
Return mStatusComments.Trim
End Get
Set(ByVal Value As String)
mStatusComments = Value
End Set
End Property
saved proc call:
Common.RunSP(mDBConnStr, "ProjectStatusUpdate", _
Common.MP("@UID", SqlDbType.NVarChar, 40, mUID), _
Common.MP("@ProjID", SqlDbType.VarChar, 40, mID), _
Common.MP("@StatusID", SqlDbType.Int, 8, mStatusID), _
Common.MP("@Comments", SqlDbType.NVarChar, 4000, mStatusComments), _
Common.MP("@PCTComp", SqlDbType.Int, 4, 0), _
Common.MP("@Type", Common.TDSqlDbType.TinyInt, 1, EntryType))
. ,
"test
"
( ) , "" , :
?txtComments.Text
"test test"
?txtComments.Text.Trim
"test
test"
?txtComments.Text(4)
"
"c
?txtComments.Text.Trim()(4)
"
"c
- , ?