• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 114
  • Last Modified:

passing formatted text from one textbox to another

Experts:

I'm passing the text from one textbox, to a textbox on a usercontrol I've created. if the original text is formatted in anyway, once I pass it to the user control I lose the formatting and receive only the text. What's the best way for me to pass the formatted text from one control to another?

here's a snippet of my  code:

textbox txtnotes = (textbox)myctrl.FindControl("txtRecievingNotes")

txtnotes.Text = txtPassingNotes.Text

Thanks in advance for the help,
0
telliot79
Asked:
telliot79
  • 4
  • 2
3 Solutions
 
Kyle AbrahamsSenior .Net DeveloperCommented:
How is the formatting done?  Are you setting styles?
0
 
David Johnson, CD, MVPOwnerCommented:
Text boxes don't contain formatting. Rich Text Boxes do..
0
 
telliot79Author Commented:
Sorry, I should have been clearer - I'm talking about line breaks, bullet points, tabs, etc.

when I populate the text from one control to the other, it just comes through as one long string of text and ignores the tabs and line breaks I've created.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Kyle AbrahamsSenior .Net DeveloperCommented:
How are you creating the tabs / bullet points / etc?

The textbox won't support this by default so what kind of control are you using?  And confirm this is asp.Net?
0
 
telliot79Author Commented:
I'm just copy and pasting from word into the text box. it's asp.net and just an asp.net textbox control. the spacing is really the problem.
0
 
telliot79Author Commented:
this seems to have solved my main problem:

txtnotes.Text = txtPassingNotes.Text.Replace(Environment.NewLine, "<br />");
0
 
telliot79Author Commented:
Thanks Kyle. your answers helped me understand my problem and find a solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now