Better way than Label to use function to replace text in web page?

K

Kent P. Iler

Hi,

I'm creating a website where I need to pull data from a database, and
display it on a page. This isn't a place where a repeater or datagrid makes
sense. I was using labels and setting the text equal to the values that I
needed to display. That works OK in most places, but in areas where there
are memo fields requiring multiple lines, a label doesn't cut it.

What would be the best thing to use instead of a label, and allow the
code-behind functions to set the value?

Thanks!

-- Kent Iler
 
B

Brock Allen

Memo fields? So you mean you want the text to wrap? If you, so you can replace
the "\r\n" with "<br/>" with String.Replace.
 
S

Steve C. Orr [MVP, MCSD]

You could use a TextBox with its Multiline property set to true.
 
K

kentiler

I tried that but it didn't work with a label. Can the label have HTML
in it?

Thanks!

--Kent
 
K

kentiler

But I don't know how long the text will be, and so I don't want to do a
fixed number of rows. I want something that will only be as large as
the text, but allow for a significant amount, too - such as 4000+
characters.

Thanks!

--Kent
 
K

kentiler

Yes, Access is the data source in this case, but I'm pulling back the
data from Access and presenting it in a webform using ASP.NET.

--Kent
 
B

Brock Allen

Of course -- the label just renderes as a <span> with the Text property inside.
Hmm... now that I've mentioned it, what does the spec say about that... Well,
my quick test shows that it's ok. If it doesn't work for you, you can always
use a LiteralControl with the <br> in side of it.
 

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,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top