473,396 Members | 1,766 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,396 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 18396
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...
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.