|
-
Jan 24th, 2003, 05:02 PM
#1
Thread Starter
Lively Member
How to specify the position of a label control ?
Hi All,
In my app, i need to dynamically generate several label control . My problem is how to specify the position of those controls.
For example,
Dim lblNew As New System.Web.UI.WebControls.Label()
now, i want the lblNew located on the specified location. How can i do that ?
-
Jan 24th, 2003, 07:32 PM
#2
Lively Member
Why not put the lable where you want it then set its visible preperty to false then when you need to use it enable it. Just a thought.
"Find all you need in your mind if you take the time" -DT
-
Jan 27th, 2003, 09:54 AM
#3
Thread Starter
Lively Member
Cin0s3 , thank you for the reply. But in my application, the number of label controls can't be determined in advance. I understand i could create a large enough set of labels on the interface and then visible them dynamcially. But still, i want to know if there is a way to dynamically create and locate controls based on request.
-
Jan 27th, 2003, 12:41 PM
#4
lblNew.Attributes.Add("style", "position: absolute; top: 20px; left: 20px")
Remember that Run-time created components do not persist view state, meaning you will need to recreate them on every post back if you want them to remain on screen.
You also cannot tie event handlers to run time created controls in ASP.Net. You can in VB.NET, just not ASP.NET
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Jan 27th, 2003, 01:06 PM
#5
Thread Starter
Lively Member
Thank you so much Lord_Rat. And you also solved my other question about losing the dynamically-created ctrl on post back. Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|