RSS

TextArea control manage Enter,Space Character with vb.net

17 May

if you want to save your TextArea or Text with Multitextmode and you manage the Enter ,Space Character

Then you use this Function and just you pass first text box value before save.

like

For Html Control

Dim strMessage As String = GetMessage(HttpUtility.HtmlEncode(Trim(Request.Form(“txtAdtRmrks”))))

For SERVER  Control aspx control

Dim strMessage As String= GetMessage(txtcomments.text)

Public Shared Function GetMessage(ByVal obj As Object) As String
Dim str As String = “”
Dim lbl As New HtmlGenericControl
If Not obj Is Nothing Then
str = obj.ToString
str = Replace(str, vbCrLf, “<br />”)
lbl.InnerHtml = str
Return lbl.InnerText.ToString
Else
Return “”
End If
End Function

Advertisements
 
1 Comment

Posted by on May 17, 2011 in Vb.Net

 

Tags: , ,

One response to “TextArea control manage Enter,Space Character with vb.net

  1. varda

    June 12, 2011 at 7:28 am

    It’s a great tip! Thanks

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: