By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,743 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,743 IT Pros & Developers. It's quick & easy.

Add a block of HTML to my asp.net page

P: n/a
TPS
I want to add a block of html to asp.net page.

How can I add the HTML to a certain location on my page.

Thanks.

TPS
Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Create a user control

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
----------------------------------------------------------------------------
------------------------------------
<blatant plug>
Professional .NET for Java Developers with C#- ISBN: 1-861007-91-4
Professional Windows Forms - ISBN: 1861005547
Professional JSP 2nd Edition - ISBN: 1861004958
Professional JSP - ISBN:
1861003625
Beginning JSP Web Development - ISBN: 1861002092
</blatant plug>
----------------------------------------------------------------------------
------------------------------------

"TPS" <tp*@tps.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
I want to add a block of html to asp.net page.

How can I add the HTML to a certain location on my page.

Thanks.

TPS

Nov 18 '05 #2

P: n/a
At design time or run time?
At design time you could create & use a user control.
At run time you could fill in a placeholder control or maybe a panel.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"TPS" <tp*@tps.com> wrote in message
news:Oa****************@TK2MSFTNGP11.phx.gbl...
I want to add a block of html to asp.net page.

How can I add the HTML to a certain location on my page.

Thanks.

TPS

Nov 18 '05 #3

P: n/a
I've found you can either bind <%# test %> or use the old style <%=
test %> to output html.

<stript>...

public string test = "<p> Hello World </p>";

</stript>
<html> .....
<%= test %>

</html>

"TPS" <tp*@tps.com> wrote in message news:<Oa**************@TK2MSFTNGP11.phx.gbl>...
I want to add a block of html to asp.net page.

How can I add the HTML to a certain location on my page.

Thanks.

TPS

Nov 18 '05 #4

P: n/a
TPS
Thank you all for your suggestions.

It looks like the easiest route is to put the HTML in a Label control.

That is what I did and it seems to work just fine.

Are there any drawbacks to this approach?

Thanks,

TPS

Nov 18 '05 #5

P: n/a
Hi TPS,
Thanks for your followup. I'm glad that you've figured out the proper means
to resolve the issue. As the drawbacks of this means you mentioned, I don't
think there is any obvious or potential problems on it. :) In fact, the
ASP.NET Label control is rendered as a <span> html element to the output.
For example:
such a Label as
<asp:Label id="Label1" runat="server">Label</asp:Label>
will be rendered out as below:
<span id="Label1">Label</span>

So, when you input any html code in an Label, it is equals that you put
some html code in a <span> </span> tag, do you think so?

For more detailed info on the <span> html element, you may view the
following web referernces:

#html tutorials. html span tag
http://www.hypergurl.com/span.html

#Div and Span
http://www.goer.org/HTML/intermediate/div_and_span/

Please check out the preceding items. If you have any further questions,
please feel free to let me know.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.