Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: absolute positioning for label controls


Message #1 by "Tom Harman" <tharman@h...> on Wed, 29 May 2002 14:26:45
This is from Microsoft MSDN:

<%@ Page Language="VB" %>
<html>
 <head>
     <script language="VB" runat="server">
         Sub Button1_Click(Sender As Object, e As EventArgs)
            Dim l2 As New Label()
            l2.Text = "This is a new Label"
            l2.BorderStyle = BorderStyle.Solid
            Page.Controls.Add(l2)
         End Sub
     </script>
  </head>
 <body>
     <h3>Label Example</h3>
     <form runat="server">
          <asp:Button id="Button1" Text="Create and Show a Label" 
         OnClick="Button1_Click" Runat="server"/>
      </form>
 </body>
 </html>

How do I impose absolute positioning on this label?
TIA
Message #2 by "Tom Harman" <tharman@h...> on Thu, 30 May 2002 14:29:51 -0400
My boss solved this, although MSDN documentation could be a little more
straightforward.

For anyone who wants to know, where 12 is the defined label, add after:
            l2.BorderStyle = BorderStyle.Solid

            12.Style("Position") = "absolute"
            12.Style("Left") = "24px"
            12.Style("Top") = "90px"

Evidently you can change any Style attribute using the Style collection.


-----Original Message-----
From: Tom Harman [mailto:tharman@h...]
Sent: Wednesday, May 29, 2002 2:27 PM
To: ASP+
Subject: [aspx] absolute positioning for label controls


This is from Microsoft MSDN:

<%@ Page Language="VB" %>
<html>
 <head>
     <script language="VB" runat="server">
         Sub Button1_Click(Sender As Object, e As EventArgs)
            Dim l2 As New Label()
            l2.Text = "This is a new Label"
            l2.BorderStyle = BorderStyle.Solid
            Page.Controls.Add(l2)
         End Sub
     </script>
  </head>
 <body>
     <h3>Label Example</h3>
     <form runat="server">
          <asp:Button id="Button1" Text="Create and Show a Label"
         OnClick="Button1_Click" Runat="server"/>
      </form>
 </body>
 </html>

How do I impose absolute positioning on this label?
TIA

Message #3 by "Dave Rezoski" <daverezoski@h...> on Thu, 30 May 2002 18:58:07 +0000
Another approach would be to reference a cssClass for the label.  Within the 
class you can set the position and all other css attributes, as shown 
below...

in your aspx:
<asp:label id="mylabel" cssclass="myLabelClassName">My Label</asp:label>

in your stylesheet:
.myLabelClassName
{
position:absolute;
top:25px;
left:100px;
background-color:purple;
font-family:arial;
}


----Original Message Follows----
From: "Tom Harman" <tharman@h...>
Reply-To: "ASP+" <aspx@p...>
To: "ASP+" <aspx@p...>
Subject: [aspx] RE: absolute positioning for label controls
Date: Thu, 30 May 2002 14:29:51 -0400

My boss solved this, although MSDN documentation could be a little more
straightforward.

For anyone who wants to know, where 12 is the defined label, add after:
             l2.BorderStyle = BorderStyle.Solid

             12.Style("Position") = "absolute"
             12.Style("Left") = "24px"
             12.Style("Top") = "90px"

Evidently you can change any Style attribute using the Style collection.


-----Original Message-----
From: Tom Harman [mailto:tharman@h...]
Sent: Wednesday, May 29, 2002 2:27 PM
To: ASP+
Subject: [aspx] absolute positioning for label controls


This is from Microsoft MSDN:

<%@ Page Language="VB" %>
<html>
  <head>
      <script language="VB" runat="server">
          Sub Button1_Click(Sender As Object, e As EventArgs)
             Dim l2 As New Label()
             l2.Text = "This is a new Label"
             l2.BorderStyle = BorderStyle.Solid
             Page.Controls.Add(l2)
          End Sub
      </script>
   </head>
  <body>
      <h3>Label Example</h3>
      <form runat="server">
           <asp:Button id="Button1" Text="Create and Show a Label"
          OnClick="Button1_Click" Runat="server"/>
       </form>
  </body>
  </html>

How do I impose absolute positioning on this label?
TIA






_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


  Return to Index