473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

can I add a style to RadioButtonList?

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
Oct 9 '06 #1
6 2848
most likely there is a problem in your css code

"Kevin Blount" <ke**********@LOLgmail.comwrote in message news:uU*************@TK2MSFTNGP03.phx.gbl...
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

Oct 10 '06 #2
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>

Jon Paal wrote:
most likely there is a problem in your css code

"Kevin Blount" <ke**********@LOLgmail.comwrote in message news:uU*************@TK2MSFTNGP03.phx.gbl...
>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

Oct 10 '06 #3
<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
-----------------------------------------
Oct 10 '06 #4
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
Gaurav Vaish (www.EdujiniOnline.com) wrote:
><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).

Oct 10 '06 #5
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" <ke**********@LOLgmail.comwrote in message
news:uU*************@TK2MSFTNGP03.phx.gbl...
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

Oct 10 '06 #6
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" <ke**********@LOLgmail.comwrote in message news:OW**************@TK2MSFTNGP04.phx.gbl...
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>

Jon Paal wrote:
>most likely there is a problem in your css code

"Kevin Blount" <ke**********@LOLgmail.comwrote in message news:uU*************@TK2MSFTNGP03.phx.gbl...
>>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
Oct 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tapi | last post by:
Hello there, I am new to ASP .NET and am tryimg to create a RadioButtonList dynamically. My code below gives an "Index was out of range" error. Where am I going wrong?
6
by: Hazzard | last post by:
I store radiobuttonlist values in the db using the string value of the radio button item value. (nvarchar) I am creating an edit functionality on the asp.net form so that when I reuse my...
3
by: William LaMartin | last post by:
If I create a RadioButtonList with, say, two items, then after the page loads and I select one of the items and then click on a button whose click event contains some code to display the...
5
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 --...
6
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and...
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
4
by: juststarter | last post by:
Hello, I have an aspx file where i've put a placeholder element. On load (page_load) i create dynamically an html table which contains a checkbox and a radiobuttonlist in each tablerow . The...
5
by: Øyvind Isaksen | last post by:
I'm making a page to update articles. When a radiobuttonlist is displayed, I want the stored value to be displayed as default (checked). Example: I use a procedure to display the...
6
by: Kevin Blount | last post by:
Here's the C# code I'm trying to add: <% listitem1.Text = commIndexText.ToString(); listitem2.Text = commIndexText.ToString(); listitem3.Text = commIndexText.ToString(); %>...
6
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.