Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 28th, 2004, 12:12 PM
Registered User
Join Date: May 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically change html code of a page

I want to change the html tag of a Label

<asp:Label id="lbl" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 40px" runat="server">Label</asp:Label>

<asp:Label id="lbl" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 40px" runat="server"><a name="anchor">Label</a></asp:Label>

by hitting a button.

Could someone tell me how could I implement that with c#?

Old July 28th, 2004, 01:49 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts

You can't achieve that by decoding the HTML:

lbl.Text = Server.HtmlDecode("<a name="anchor">Label</a>")

If that doesn't work, I don't know what your other option to do since the label control is not a container control.

Old July 29th, 2004, 01:38 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

lbl.Text = Server.HtmlDecode("<a name=anchor>Label</a>")
it works fine.
Thanks to Brian.


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to dynamically change an HTML page kpnikhil PHP How-To 1 September 7th, 2007 03:53 AM
Code change; Page 1074; Ch21 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 August 3rd, 2006 09:18 AM
How to change the globalization dynamically? sfs00784 General .NET 1 July 16th, 2004 04:13 AM
Change a button's name dynamically pigtail Javascript 2 April 11th, 2004 06:02 PM
Dynamically change event handlers oranginalab Javascript How-To 2 July 31st, 2003 10:11 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.