Link to home
Start Free TrialLog in
Avatar of kwh3856
kwh3856Flag for United States of America

asked on

Unable to move labels freely in the VS 2008 HTML designer

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.
Avatar of naspinski
naspinski
Flag of United States of America image

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

Avatar of kwh3856

ASKER

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
 
Avatar of kwh3856

ASKER

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>
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.
Avatar of kwh3856

ASKER

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
 
ASKER CERTIFIED SOLUTION
Avatar of naspinski
naspinski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kwh3856

ASKER

Once again....THANK YOU VERY MUCH!!!! ;)