Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 15th, 2006, 06:50 AM
Registered User
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Positioning of Controls

I would like to dynamically put several labels in a placeholder or panel. The top and left position of the labels should be programmable. Like this:

For i = 5 To 23
  Dim objLabel As New Label
  objLabel.Text = MyText
  objLabel.Style("Top") = myTop
  objLabel.Style("Left") = myLeft
  objLabel.Style("Width") = myWidth
  objLabel.Style("Position") = "relative"
  pnl.Controls.Add(objLabel)
Next

If the position is "relative" the labels a placed next to each other in the panel (wrong). If position is "absolute" then the labels are positioned correctly but not in the panel. How do I get the labels to be absolute inside the panel? Is it at all possible?

Thanks for your comments


 
Old September 22nd, 2006, 11:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

Hiya,

CSS absolute vs relative positioning is a bit tricky. This page - http://www.yourhtmlsource.com/styles...csslayout.html - gives a good definition and comparison of them both. Relative positioning is what you need though by the sound of it. The trick is to remember that you are defining position relative to the table cell that the panel renders into when the page is created. Try running your page in Firefox and use the Web Developer tool to outline the table \ see the styles on your controls. If not, reply back with a sample page demonstrating the problem and we'll see what we can do to help.

dan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic User Controls.... Jayahar ASP.NET 2.0 Professional 8 October 12th, 2007 01:27 AM
Create dynamic controls saulodet C# 2 November 21st, 2003 12:36 PM
Dynamic Controls [xx(] koneruvijay VS.NET 2002/2003 0 November 12th, 2003 12:02 AM
Dynamic Controls tommyuk VB How-To 2 June 26th, 2003 12:54 PM





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