Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

can I add a style to RadioButtonList?

0 views
Skip to first unread message

Kevin Blount

unread,
Oct 9, 2006, 2:50:14 PM10/9/06
to
Here's the C# code I'm trying to add:

<%
listitem1.Text = commIndexText["tx_3"].ToString(); listitem2.Text =
commIndexText["tx_8"].ToString();
listitem3.Text = commIndexText["tx_9"].ToString();
%>
<asp:RadioButtonList CssClass="smallFont" ID="login_details"
runat="server" TextAlign="right">
<asp:ListItem ID="listitem1" Value=1 ></asp:ListItem>
<asp:ListItem ID="listitem2" Value=2 ></asp:ListItem>
<asp:ListItem ID="listitem3" Value=3 ></asp:ListItem>
</asp:RadioButtonList>

the three .Text lines at the top get text from a database and put it in
place, which works fine

The RadioButtonList specifies the CssClass as "smallFont", which is
Tahoma 8pt, but this isn't applied to the text I add to my ListItems.

Can anyone help me understand why?

TIA

Kevin

nospam ]Paal @everywheredotcom Jon Paal

unread,
Oct 10, 2006, 12:12:17 AM10/10/06
to
most likely there is a problem in your css code

"Kevin Blount" <kevin....@LOLgmail.com> wrote in message news:uUU5DP9...@TK2MSFTNGP03.phx.gbl...

Kevin Blount

unread,
Oct 10, 2006, 1:19:36 AM10/10/06
to
Possibly, but that class works perfectly on all other elements, and if I
apply it manually it works too, i.e.

listitem1.Text = "<span class='smallFont'>" +
commIndexText["tx_3"].ToString() + "</font>";

It also works on other .NET form controls, such as <asp:TextBox>

Gaurav Vaish (www.EdujiniOnline.com)

unread,
Oct 9, 2006, 11:59:24 PM10/9/06
to
> <asp:RadioButtonList CssClass="smallFont" ID="login_details"
> runat="server" TextAlign="right">

> The RadioButtonList specifies the CssClass as "smallFont", which is Tahoma

> 8pt, but this isn't applied to the text I add to my ListItems.

Because the CSS-Class is only for the table generated.

You will need to have CSS-Class for each ListItem that you add... I'm
afraid, there's no other way out (AFAIK).


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com
-----------------------------------------


Kevin Blount

unread,
Oct 10, 2006, 12:13:03 PM10/10/06
to Gaurav Vaish (www.EdujiniOnline.com)
Thanks for the reply, Gaurav.

I think I tried adding the style to the ListItem as well, with no luck.
I'll revert to adding <span class=> when adding the listitem.Text; it's
dirty, but it works :)

Kevin

clintonG

unread,
Oct 10, 2006, 12:15:01 PM10/10/06
to
This hack can be used to style list items...
<asp:ListItem Value="Sunday" Text="<span class='className'>Sunday</span>" />

But my hack as noted above doesn't work for removing colored background the
POS IE applies to checkboxes and radio buttons.

Does anybody know how to get rid of the colored background? This bug showed
up a long long time ago and at one time I had and used the hack to
work-around the POS IE but I've forgotten the hack and don't seem to have a
copy of the hack in my snippets collection.


<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

"Kevin Blount" <kevin....@LOLgmail.com> wrote in message
news:uUU5DP9...@TK2MSFTNGP03.phx.gbl...

nospam ]Paal @everywheredotcom Jon Paal

unread,
Oct 12, 2006, 12:48:10 PM10/12/06
to
could be a case problem.

try renaming the attribute to :

cssClass="smallFont"

also make sure the case of the name matches the css file case


"Kevin Blount" <kevin....@LOLgmail.com> wrote in message news:OWyCwuC7...@TK2MSFTNGP04.phx.gbl...

0 new messages