Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textarea carriage return

Status
Not open for further replies.

crxcte1

Programmer
May 22, 2003
74
US
I've tried setting wrap to hard and soft but can not get a physical wrap. I tried setting to physical from MS help with no change. Anyway to wrap the text in a textarea?

<textarea id="txtBody1" rows="15" wrap="hard" cols="50" runat="server" tabindex="2">
 
Try this:
Code:
<asp:TextBox id="txtContent" runat="server" Columns="50" Rows="10" TextMode="multiline"></asp:TextBox>

Regards
Satish
 
More information, using c# and mailing the information in the textarea. After receiving the text there is no carriage return which is evident before mailing.
 
Added;

<textarea id="txtBody1" rows="15" wrap="soft" cols="50" runat="server" tabindex="2" textMode="multiline"></textarea>

I typed in;

tres
return


then submitted to me in an email and got;

tres return

There needs to be a return at return. I'm willing to try anything at this point.
 
Hmmm...is your email script enabled to send content as HTML? There must be something like isHTML = true in your email object. That might be the problem.


Regards
Satish
 
Where in this code should isHtml == true?

void SendThis(string HowToSend)
{
Span1.InnerHtml = "<B>Sending mail to </B>" + HowToSend;
string sFrom = "ClubMail@OKCrunning.org";
string sSubject = txtSubject.Text.Trim();
string sBody = txtBody1.Value;
string sBodyFormat = "HTML";
string sBodyEncoding = Encoding.ASCII.EncodingName;
string sPriority = "HIGH";
string sMailServer = "localhost";
string sendPassword = txtSendPwd.Text;
MailMessage MyMail = new MailMessage();
MyMail.From = sFrom;
MyMail.Subject = "From " + txtSendFname.Text + " " + txtSendLname.Text + ": " + sSubject;
MyMail.Body = sBody;
MyMail.Bcc = "fastaction@cox.net";
if (sBodyEncoding == Encoding.UTF7.EncodingName)
MyMail.BodyEncoding = Encoding.UTF7;
else if (sBodyEncoding == Encoding.UTF8.EncodingName)
MyMail.BodyEncoding = Encoding.UTF8;
else
MyMail.BodyEncoding = Encoding.ASCII;
switch (sBodyFormat.ToUpper())
{
case "HTML":
MyMail.BodyFormat = MailFormat.Html;
break;
default:
MyMail.BodyFormat = MailFormat.Text;
break;
}
SmtpMail.SmtpServer = sMailServer;
String FilePath;
FilePath = Server.MapPath("/_database/members.mdb");
//FilePath="C:\\ASPdotnet\\MembersList\\Database\\members2.mdb";
string strConn="Provider=Microsoft.Jet.OLEDB.4.0;DATA Source=" + FilePath;
OleDbConnection myConn = new OleDbConnection(strConn);
OleDbDataReader drMembers;
string pwdMatch,CheckPwd,strSQL;
...
 
Yeah from the code HTML seems to be set. See the lines in your code:

Code:
string sBodyFormat = "HTML";

switch (sBodyFormat.ToUpper())
{
case "HTML": 
MyMail.BodyFormat = MailFormat.Html

This is where the HTML is being set. Check if sBodyFormat is actually on HTML.


Thanks and Regards
Satish Kumar
 
OK, try one other thing. Take the txtBody1.Value and use the replace function to convert all carriage returns to <BR>.


Thanks and Regards
Satish Kumar
 
I used the replace method and it worked like a charm.

Thank you for your help.

cr

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top