473,698 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Applying CSS to asp:ListItem

My problem child:

<asp:dropdownli st 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:dropdownlis t>

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 11095
In your Page_Load...
ddLimit.Items(0 ).attributes.ad d("Class","clas sName")
ddLimit.Items(1 ).attributes.ad d("Class","clas sName")
ddLimit.Items(2 ).attributes.ad d("Class","clas sName")

"Merennulli " <ma****@sdf.lon estar.orgwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
My problem child:

<asp:dropdownli st 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:dropdownlis t>

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.ad d("Class","clas sName")
ddLimit.Items(1 ).attributes.ad d("Class","clas sName")
ddLimit.Items(2 ).attributes.ad d("Class","clas sName")

"Merennulli " <ma****@sdf.lon estar.orgwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
My problem child:

<asp:dropdownli st 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:dropdownlis t>

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.ad d("Class","clas sName")
ddLimit.Items(1 ).attributes.ad d("Class","clas sName")
ddLimit.Items(2 ).attributes.ad d("Class","clas sName")

"Merennulli " <ma****@sdf.lon estar.orgwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
My problem child:

<asp:dropdownli st 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:dropdownlis t>

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
1565
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 be read from resource files. Right now, I'm doing it by the following code ListItem items = new ListItem{new ListItem(resourceManager.GetString("YES"), "Yes"), new
2
2917
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 thinking that might not be the most accessible way to handle this anyways. So...I wanted to just attach a javascript event to the specific listitem and have that toggle the visibility of the text field (wrapped in a span).
0
1025
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 will have a Response.Redirect and the checkbox values will be used in the url redirect. tia,
5
1849
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> <asp:ListItem Value=0>&nbsp;</asp:ListItem> <asp:ListItem Value=1>Awaiting</asp:ListItem> <asp:ListItem Value=2>Current</asp:ListItem> <asp:ListItem Value=3>Terminated</asp:ListItem>
0
2305
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" HeaderText="ID"></asp:BoundColumn> <asp:TemplateColumn HeaderText="O"> <ItemTemplate> <asp:DropDownList id="cmbObdelaj" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDown_SelectedIndexChanged">
0
3327
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" HeaderText="ID"></asp:BoundColumn> <asp:TemplateColumn HeaderText="O"> <ItemTemplate> <asp:DropDownList id="cmbObdelaj" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDown_SelectedIndexChanged">
4
4683
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 Country. I have 6 .txt files that contain a complete list of countries that we sell to (65 in total), each written in the appropriate way for the language of the site, e.g. Mexico for English US and UK sites and México for the Spanish language...
1
1334
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. This should work. Does any one know why it does not or of there is a work around? Thanks
7
2769
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 to be blank. I've tried doing this: <asp:ListItem Value="0">&nbsp;</asp:ListItem>
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7741
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.