Insert text into an ASPx page

  • Thread starter Thread starter Ankit Aneja
  • Start date Start date
Hi
New to the .NET framework, but have been on 2124C, and have come back to
work to be asked to do ADO and ASPx (not covered in course!). The probelm i
am having is that I have created an ASPx page with some text in, and need to
add a block of text at a particular place from a database table (reading the
data I can do) - can anyone point me in the direction of some sample
code/examples on how to do this? The reason behind it is that mosst of the
text being used is generic, but particular apps have specific additional
text, and I want to find the best way to achieve this.
Thanks in advance
Martin
 
Hi
I think it is plain text, and have been playing with literals - it seems to
display better irrespective of how much text is inserted. If I want to add
in HTML tagged text, what are my options?
Thanks
Martin
 
You can put a Placeholder control situated in the exact place on the page
that you need. Then you can add controls to this after you get your data. It
could be an Generic control, label, Panel, whatever you need.
Peter
 
Peter
OK - that sort of makes sense. So, how do you control a placeholder? Can
you turn on/off display?
Regards
Martin
 
I think it is plain text, and have been playing with literals - it
seems to display better irrespective of how much text is inserted. If
I want to add in HTML tagged text, what are my options?

Almost any HTML tag can be made accessible to the code-behind by adding a
tag 'runat=server' and 'id=<name>' as attributes. You can then access the
"inside" of the tag with <name>.innerHtml. You could do this with a div or
a span or whatever suits your needs.

-mdb
 
Hi,

Just use a Label , also you could use a DIV and set the text in your code.

In reality there are multiple ways of doing it, it's a simple task
 
Hi
Used the placeholder (as suggested) and the appropriate tags to sort it out
- once I'd looked at the hlp for Placeholder, it all made sense.
Thanks for your time
Martin
 
Back
Top