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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Checkboxes

Status
Not open for further replies.

kennyaidan

Programmer
Apr 9, 2003
54
IE
Hi,
I was looking to find out how to format a list of check boxes. My check box code is

<asp:CheckBoxList id=&quot;check&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot;/>

They are set up in the code using the following code
dim mylist=New ArrayList
while (dr.Read())
aidan=dr.GetString(0)
aidan1=dr.GetString(1)
aidan2=dr.GetString(2)
aidan3=dr.GetString(3)
mylist.Add(aidan)

End While

check.DataSource=mylist
check.DataBind()

Where can i add in font formating tags do that lets say all checkboxes are displayed using the following font type size and color
<font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;3&quot; color=&quot;#3B52B9&quot;>

I'm only a beginner asp.net programmer so any help greatly appreciated
Thanks
aidan
 
Try using a style tag. I can't find the website, but here is my code I was playing around with:

<%@ Page Language=&quot;VB&quot; %>
<script runat=&quot;server&quot;>

' Insert page code here
'
Sub Page_Load(Sender As Object, E As EventArgs)

'If Not Page.IsPostBack Then
Button1.Style(&quot;background-color&quot;) = &quot;Lightblue&quot;
Button1.Style(&quot;FONT&quot;) = &quot;14pt verdana&quot;

'End If


End Sub

Sub Button_Click(Sender As Object, E As EventArgs)
Button1.Style(&quot;background-color&quot;) = &quot;Yellow&quot;
Button1.Style(&quot;FONT&quot;) = &quot;20pt verdana&quot;
DropDownList1.Style(&quot;background-color&quot;) = &quot;Yellow&quot;
End Sub

Sub subListChanged(sender As Object, e As EventArgs)

Button1.Style(&quot;background-color&quot;) = DropDownList1.SelectedItem.Value

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat=&quot;server&quot;>
<p>
<asp:Button id=&quot;Button1&quot; style=&quot;BORDER-LEFT-COLOR: black; BORDER-BOTTOM-COLOR: black; FONT: 8pt verdana; BORDER-TOP-COLOR: black; BACKGROUND-COLOR: lightgreen; BORDER-RIGHT-COLOR: black&quot; onclick=&quot;Button_Click&quot; runat=&quot;server&quot; Text=&quot;Click Me!&quot; Button=&quot;Button&quot; Width=&quot;174px&quot; Height=&quot;31px&quot; Font-Bold=&quot;True&quot;></asp:Button>
</p>
<p>
<font face=&quot;Book Antiqua&quot;><strong>Make a color selection for the above button:</strong></font>
</p>
<p>
<asp:DropDownList id=&quot;DropDownList1&quot; style=&quot;FONT: 14pt verdana; COLOR: purple; BACKGROUND-COLOR: lightblue&quot; runat=&quot;server&quot; Width=&quot;282px&quot; OnSelectedIndexChanged=&quot;subListChanged&quot; AutoPostBack=&quot;True&quot;>
<asp:ListItem Value=&quot;-- Make a Selection --&quot;>-- Make a Selection --</asp:ListItem>
<asp:ListItem Value=&quot;red&quot;>Red</asp:ListItem>
<asp:ListItem Value=&quot;yellow&quot;>Yellow</asp:ListItem>
<asp:ListItem Value=&quot;blue&quot;>Blue</asp:ListItem>
</asp:DropDownList>
</p>
</form>
</body>
</html>

I wanted to change the style on the fly. If you look up asp.net and style in Google, you may find lots.

Good luck :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top