Can an asp:textbox produce HTML?

N

needin4mation

Hi, I have this in my asp.net 1.1 page:

<asp:textbox id="Comment" tabIndex="4" runat="server"></asp:textbox>

Inside the tags, say I have:

<b>I am bold.</b>

When I run the page I get the tags, the HTML, with the sentence. But
how can I get it to render the sentence bold using the tags?

Thank you.
 
C

Chris

The asp.net control is just parsed using a huge regex and turned into
an <input> or <textarea> HTML tag. To support styling, you need an
editable iframe or div. Take a look at http://www.freetextbox.com/ they
have already done it for you.
 
E

Eliyahu Goldin

An asp.net textbox renders as <input type=text...>. You can attach a style
to it, but you can use it as an html-enabled editor because it is not.

Eliyahu
 
N

needin4mation

Chris said:
The asp.net control is just parsed using a huge regex and turned into
an <input> or <textarea> HTML tag. To support styling, you need an
editable iframe or div. Take a look at http://www.freetextbox.com/ they
have already done it for you.

Either I do not understand you response, or I was not clear. Change it
from a textbox to a label with this:

<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "Comments")%>
' runat="server" />

In the database there is HTML surrounding the text. Can I make it show
up rendered with the HTML in the label control?

Thanks again for any help.
 
C

Chris

Either I do not understand you response, or I was not clear. Change it
from a textbox to a label with this:

<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "Comments")%>
' runat="server" />

In the database there is HTML surrounding the text. Can I make it show
up rendered with the HTML in the label control?

Thanks again for any help.

Yes HTML will render correctly for a label control, as it just renders
as a DIV or SPAN html tag.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,147
Latest member
CarenSchni
Top