473,406 Members | 2,336 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,406 software developers and data experts.

Applying CSS to asp:ListItem

My problem child:

<asp:dropdownlist id="ddlLimit" tabIndex="6" runat="server"
EnableViewState="False" CssClass="query">
<asp:ListItem Value="100" Selected="True">100</asp:ListItem>
<asp:ListItem Value="250">250</asp:ListItem>
<asp:ListItem Value="500">500</asp:ListItem>
</asp:dropdownlist>

My intent is to make this a gradiation of colors from blue to red,
giving 100 a natural "positive" feel and 500 a natural "negative" feel.
100 gives the top 100 results, while 500 gives the top 500, and of
course takes about 4x as long. I'm trying to encourage leaving it on
the 100 without being obtrusive.

The problem is, CssClass=, Class= and ID= don't get passed with
asp:listitem. I need to either find a CSS method of referencing them
individually, or an ASP.NET way of passing an identifier or class with
them. Any ideas?

Aug 8 '06 #1
3 10958
In your Page_Load...
ddLimit.Items(0).attributes.add("Class","className ")
ddLimit.Items(1).attributes.add("Class","className ")
ddLimit.Items(2).attributes.add("Class","className ")

"Merennulli" <ma****@sdf.lonestar.orgwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
My problem child:

<asp:dropdownlist id="ddlLimit" tabIndex="6" runat="server"
EnableViewState="False" CssClass="query">
<asp:ListItem Value="100" Selected="True">100</asp:ListItem>
<asp:ListItem Value="250">250</asp:ListItem>
<asp:ListItem Value="500">500</asp:ListItem>
</asp:dropdownlist>

My intent is to make this a gradiation of colors from blue to red,
giving 100 a natural "positive" feel and 500 a natural "negative" feel.
100 gives the top 100 results, while 500 gives the top 500, and of
course takes about 4x as long. I'm trying to encourage leaving it on
the 100 without being obtrusive.

The problem is, CssClass=, Class= and ID= don't get passed with
asp:listitem. I need to either find a CSS method of referencing them
individually, or an ASP.NET way of passing an identifier or class with
them. Any ideas?

Aug 8 '06 #2
Thank you, I hadn't thought of that.

Scott M. wrote:
In your Page_Load...
ddLimit.Items(0).attributes.add("Class","className ")
ddLimit.Items(1).attributes.add("Class","className ")
ddLimit.Items(2).attributes.add("Class","className ")

"Merennulli" <ma****@sdf.lonestar.orgwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
My problem child:

<asp:dropdownlist id="ddlLimit" tabIndex="6" runat="server"
EnableViewState="False" CssClass="query">
<asp:ListItem Value="100" Selected="True">100</asp:ListItem>
<asp:ListItem Value="250">250</asp:ListItem>
<asp:ListItem Value="500">500</asp:ListItem>
</asp:dropdownlist>

My intent is to make this a gradiation of colors from blue to red,
giving 100 a natural "positive" feel and 500 a natural "negative" feel.
100 gives the top 100 results, while 500 gives the top 500, and of
course takes about 4x as long. I'm trying to encourage leaving it on
the 100 without being obtrusive.

The problem is, CssClass=, Class= and ID= don't get passed with
asp:listitem. I need to either find a CSS method of referencing them
individually, or an ASP.NET way of passing an identifier or class with
them. Any ideas?
Aug 15 '06 #3
Is there a step I'm missing? I put this in the page_load, but no
attributes get added. I even tried adding other attributes, a refresh,
etc.

Scott M. wrote:
In your Page_Load...
ddLimit.Items(0).attributes.add("Class","className ")
ddLimit.Items(1).attributes.add("Class","className ")
ddLimit.Items(2).attributes.add("Class","className ")

"Merennulli" <ma****@sdf.lonestar.orgwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
My problem child:

<asp:dropdownlist id="ddlLimit" tabIndex="6" runat="server"
EnableViewState="False" CssClass="query">
<asp:ListItem Value="100" Selected="True">100</asp:ListItem>
<asp:ListItem Value="250">250</asp:ListItem>
<asp:ListItem Value="500">500</asp:ListItem>
</asp:dropdownlist>

My intent is to make this a gradiation of colors from blue to red,
giving 100 a natural "positive" feel and 500 a natural "negative" feel.
100 gives the top 100 results, while 500 gives the top 500, and of
course takes about 4x as long. I'm trying to encourage leaving it on
the 100 without being obtrusive.

The problem is, CssClass=, Class= and ID= don't get passed with
asp:listitem. I need to either find a CSS method of referencing them
individually, or an ASP.NET way of passing an identifier or class with
them. Any ideas?
Aug 18 '06 #4

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

Similar topics

0
by: CGuy | last post by:
Hi, I have a RadioButtonList control in my aspx page which shows two radiobuttons - "Yes" and "No". Since my page is intended for international audience, I would like the texts "Yes" and "No" to...
2
by: darrel | last post by:
I have an asp:RadioButtonList. If one of the items is selected, I'd like a text field to appear. I tried using an ONCHANGE event via the codebehind, but couldn't get that to work. Plus, I'm...
0
by: dk | last post by:
if there is html code using runat="server" for a few listitem controls, what is the best way to retrieve the values of those controls to be used in a button click event. The button click event...
5
by: Mark Rae | last post by:
Hi, Has the <asp:DropDownList> - <asp:ListItem> functionality changed in v2? In v1.1, the following works as expected: <asp:DropDownList ID="cmbStatus" Runat=server EnableViewState=False>...
0
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
0
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
4
by: Kevin Blount | last post by:
As mentioned before, I'm creating a multi-lingual page where the text of the page comes from a database. This page includes a registration form which asks for address information, including the...
1
by: Scott S | last post by:
On the server side I am using: this.RadioButtonList.Items.Attributes.Add("onclick", "return DID_DATA_CHANGE();"); but it is not changing the onclicked event when the HTML is on the client side....
7
by: Jim in Arizona | last post by:
Using this: <asp:ListItem Value="0"</asp:ListItem> as long as I have a value listed and leave the area between the tags blank, when viewed the DropDownList will show a 0 as a choice. I want it...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.