?
Solved

Unable to move labels freely in the VS 2008 HTML designer

Posted on 2009-04-16
7
Medium Priority
?
421 Views
Last Modified: 2013-12-17
I am creating a web based application in VS 2008, C#, ASP.net, .net 35 sp1.  When I drag a text box on the canvas, I can move it anywhere I want to.  If I drag a lable to the canvas it will only left justify the label.  I can move it up or down anywhere I want to but I can not move it to the right.  If I drag a panel to the canvas and then place the label in the panel I can move it using the panel but that is the only way I can move the label.  Any help would be greatly appeciated.
0
Comment
Question by:kwh3856
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:naspinski
ID: 24160099
That is because a label is just a span, and a span can't really justify itself anywhere but where the container itself says (unless you float it).  You should really learn about html/css so you can understand what the designer is doing.  GUIs are helpful, but really simple things like this make you realize how valuable some html/css knowledge is.  Check http://w3schools.com for some great tuts.
<div>
  <asp:label id="lbl1" runat="server>this will be left justified because the conatiner it is is left justified by default</asp:label>
</div>
 
<div style="text-align:right;">
  <asp:label id="lbl1" runat="server>this will be right justified because the conatiner it is is right justified</asp:label>
</div>
 
<div>
  <asp:label id="lbl1" style="float:right;" runat="server>this will float to the right, but this may be confusing how it effects your flow</asp:label>
</div>

Open in new window

0
 

Author Comment

by:kwh3856
ID: 24160226
Is there any way to configure VS to automatically allow you to move the label to the right and let it calculate the "style="foat:right;"
 
Thanks
Kenny
 
0
 

Author Comment

by:kwh3856
ID: 24164724
I have just found the answer by placing mutiple labels in the same panel object just like this

<asp:Panel ID="Panel1" runat="server">

<asp:Label ID="lblBiopsyOf" runat="server" Style="z-index: 100; left: 161px; position: absolute;
top: 34px" Text="Biopsy of:" ForeColor="Black"></asp:Label>

<asp:Label ID="lblArteriogram" runat="server" Style="z-index: 101; left: 150px; position: absolute;
top: 59px" Text="Arteriogram:" ForeColor="Black"></asp:Label>
 
<igtxt:WebTextEdit ID="WebTextEdit1" runat="server" Style="z-index: 135; left: 691px;
position: absolute; top: 52px; width: 102px;">
</igtxt:WebTextEdit>


</asp:Panel>
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:naspinski
ID: 24165119
Yes, there are multiple ways to do it.

I want to warn you that the way you are doing it is very poor practice.  There are very few situations where you want mulitple absolutely position labels like that.  I can't urge you enough to learn the basics of html/css.  OTherwise you will be right back on these boards, fixing the problems youa re causing.
0
 

Author Comment

by:kwh3856
ID: 24173575
naspinski,
If it is not good practice to drag components to the canvas, what is the best way to do this?  Do you work strictly in the SOURCE screen view and only use the design screen to see if things line up?  Can you suggest some good books or places on the Internet to learn the basics of html/css?
 
Thanks
Kenny
 
0
 
LVL 21

Accepted Solution

by:
naspinski earned 2000 total points
ID: 24173740
Using the designer is fine, but when it starts pushing in style like absolute positioning and z-indexes when you don't really know what it's doing is just asking for trouble in the future.  It is always a good idea to take a look at the source ot make sure weird stuff like this isn't happening.

A good place to learn id http://w3schools.com and a favorite book of mine for this is: http://www.amazon.com/Head-First-HTML-CSS-XHTML/dp/059610197X
0
 

Author Closing Comment

by:kwh3856
ID: 31571080
Once again....THANK YOU VERY MUCH!!!! ;)
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question