Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to adjust the vertical SPACING between RadioButtonlist ListItems?

Status
Not open for further replies.

mb22

Programmer
Sep 4, 2002
258
US
I have a radiobutton list control with 5 listItems. I want the last listitem option to spaced further away than the other 4.

Can this be done with code? It seems all the Items only have EQUAL spacing.

If there is a dynamic way to add each listitem and adjust the vertical spacing I will appreciate help on it.

Thanks
Mike
 
Mike: perhaps you can add <html> elements at the time you are creating the option buttons; just an idea; but I've seen this combination (create objects + mix html elements) applied several times.
 
mb: here is a snippet of code that illustrates one approach; I'm sure there are several - in this case the html elements of a table are created dynamically in a loop calling for values (objects) in the code behind.

html = &quot;<table border='1' cellpadding='0' cellspacing='1' width='650' height='188'>&quot; & _
&quot;<tr>&quot; & _
&quot;<td width='202' align='center' height='188' rowspan='5'><a href=&quot;&quot;&quot; & strPath & &quot;&quot;&quot; Tooltip='Click to see 300K image'>&quot; & _
&quot;<img src='&quot; & strPaths & &quot;'>&quot; & _
&quot;</a></td>&quot; & _
&quot;<td width='429' height='8' align='left'><b><font color='#000080'> Date photo was taken: </font></b> &quot; & &quot;&quot; & strPhotoDate & &quot;&quot; & &quot;</td>&quot; & _
&quot;</tr>&quot; & _ '...and so on...

 
Only one thing comes to mind so far - using client side javascript to separate the last radio button form the others:
Code:
html:
<html>
 <head>    
   <script language=javascript>
     function separateLastItem(){
       var rbTbl = document.getElementById(&quot;RadioButtonList1&quot;);
       var lastRow = rbTbl.rows[rbTbl.rows.length - 1];
       lastRow.height = &quot;50px&quot;;				
     }
    </script>
  </head>
  <body onload=&quot;javascript:separateLastItem()&quot;>
    <form id=Form1 method=post runat=&quot;server&quot;>
      <asp:radiobuttonlist id=RadioButtonList1 runat=&quot;server&quot;>
	    <asp:ListItem Value=1>Item 1</asp:ListItem>
	    <asp:ListItem Value=2>Item 2</asp:ListItem>
	    <asp:ListItem Value=3>Item 3</asp:ListItem>	
	    <asp:ListItem Value=4>Item 4</asp:ListItem>
      </asp:radiobuttonlist>
    </form>	
  </body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top