Wrox Programmer Forums
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 September 13th, 2006, 11:05 AM
Registered User
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Text in Label

How do I get the value of 'it' in the text part of the label? I just keep on getting '<% =it %>' as a text in the html code.

Appreciate your comment.

<div id="MyTop" style="position: static; width: 800px; height: 300px; background-color: #9c6;">
        Dim it As Integer = 1
        For it = 1 To 23
    <asp:Label runat="server" Text="<% =it %>"></asp:Label>
    <% ....

Old September 18th, 2006, 10:22 AM
Authorized User
Join Date: Sep 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts

The code you are trying is the ASP kind of style, with asp.net 2.0 what you can do is in the page load write a piece of code like this

first in the aspx file <asp:Label runat="server" Text="" id="txt1"></asp:Label>

then in the .aspx.vb or .aspx.cs files in the page_load write the following code
txt1.text = value - for anyone Vb or CS syntax.

Check and see if this helps, else will try and help you better. Also give us an idea what scenario you plan to use it for.

Vincent Thomas
Old September 18th, 2006, 12:59 PM
Registered User
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks, I have decided to create the label in the code behind. Thank you for your comment.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Center Text within Label testsubject Visual Studio 2005 5 October 15th, 2011 12:59 PM
Need Help with Dynamic Link Label Click Events chobo2 C# 4 November 8th, 2007 03:47 AM
Label Array With Dynamic Size nevincm C# 1 April 13th, 2007 11:24 AM
Create dynamic label in vb.net snowydust VB How-To 1 July 24th, 2004 05:32 AM

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