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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

showing formatted text in textbox

Status
Not open for further replies.

e106199

Programmer
Nov 17, 2005
27
0
0
US
hi,
i have html formatted text coming from my database and i want to show it as formatted in a textbox. assigning it to a label works fine but getting the db content in a textbox gets the html text, not the formatted text. Ex: <b> test </b> shows as it is and i want to show a bold "test" in textbox.
any ideas
thank you
-shane
 
You can change how a textbox shows text using CSS. For instance..

Code:
<asp:TextBox id="TextBox1" style="font-weight: bold;" runat="server"></asp:TextBox>

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
i gave the bold as an example. i have many html statements coming from the database.
-shane
 
You can not use a TextBox control to do what you're talking about here. Any text that you retrieve from a database and apply to a TextBox is going to be applied literally. Label, TableCell, Span etc. will work. Not TextBox. If you really need to do this then check out this link:
 
No i dont want to use a third party tool that is adding at least 100K over the current page. i think i ll go with label.
thanks,
-shane
 
The label is the easiest way to go, but any html tag that you can think of can be applied in CSS style on the text box and you can do it beforehand or dynamically in code if you want to.

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top