Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / March 2008

Tip: Looking for answers? Try searching our database.

Alignment question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 22 Mar 2008 21:31 GMT
A couple of quetions regarding the following simple code provided below:

a.  Why don't the Label and the RadioButtonList align on top?  The text also
doesn't align.  

b.  Why do the radiobuttons "Self" and "Team" appear so far apart from each
other?  I'd like them to appear next to each other.  

===========================
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="frmLayoutTest.aspx.vb" Inherits="frmLayoutTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
   <title>Untitled Page</title>
   
   <style type="text/css">
       form p {
           width: 600px;
           clear: both;
       }
       form p label {
           float: left;
           width: 170px;
       }
       
       form p input, form p textarea, form p select, form p RadioButtonList {
       float: left;
       height:auto;
       width:auto;

       }
   </style>

</head>
<body>
   <form id="form2" runat="server">
   <p>This is a form.</p>

   <p>
       <label for="rblView">Allowed to Enter Time For:</label>
       <asp:RadioButtonList ID="RadioButtonList1" runat="server"
AutoPostBack="False" RepeatDirection="Horizontal" style="float:left;">
               <asp:ListItem Value="0">Self</asp:ListItem>
               <asp:ListItem Value="1">Team</asp:ListItem>
       </asp:RadioButtonList>
   </p>
       
</form>
</body>
</html>
Anthony Jones - 23 Mar 2008 20:58 GMT
> A couple of quetions regarding the following simple code provided below:
>
[quoted text clipped - 50 lines]
> </body>
> </html>

There is no actual HTML element called RadioButtonList so your CSS selector
that references it won't be doing anything

The RadioButtonList is actually implemented as a table.  It therefore has
CellSpacing and CellPadding which is why it isn't aligning as you expect.
You can apply CellSpacing="0" to the RadioButtonList control and that
attribute will appear on the generated table element.  You can control
CellPadding as an attribute or in CSS as td {padding:0}.

The reason they are so far apart is the the text next to the radio button is
contained in a label element.  You CSS gives a label element a minimum size
of 170px.

What is it your trying to achieve?

Signature

Anthony Jones - MVP ASP/ASP.NET

Dave - 24 Mar 2008 16:16 GMT
Thanks for the quick response.  Yes, this answers my questions.  Thanks
again.  

> > A couple of quetions regarding the following simple code provided below:
> >
[quoted text clipped - 68 lines]
>
> What is it your trying to achieve?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.