CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 21st, 2004, 09:53 AM
timandkitty timandkitty is offline
saved by grace
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: kansas
Posts: 85 timandkitty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Question VB: CSS Styles on ddl listitems

I am looking for a way to implement CSS styles on DropDownList ListItems. In HTML it's pretty easy:

PHP Code:
<select>
<
option class="red" value"Yes">Option 1</option>
<
option class="pink" value"No">Option 2</option
</
select


But in ASP.NET-VB I'm hitting a snag.

PHP Code:
<asp:dropdownlist id="ddlList" runat="server" Width="180px">
<
asp:ListItem Value="Yes" class="red">Option1</asp:ListItem>
<
asp:ListItem Value="No" class="pink">Option2</asp:ListItem></asp:dropdownlist


That code doesn't work. When compiled, it totally deletes the "class" attribute.

Any thoughts?
__________________
I am the way, the truth, and the life: no man cometh unto the Father, but by me.

John 14:6

Reply With Quote
  #2  
Old April 21st, 2004, 02:29 PM
fizzy's Avatar
fizzy fizzy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Dublin, Ireland
Posts: 100 fizzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 5 sec
Reputation Power: 6
hi timandkitty,

i'm only getting to grips with this .net lark myself and formatting has already caused many headaches!

but i have come across this. there is a known bug with the dropdownlist web control which prevents you froma dding attributes to it http://support.microsoft.com/defaul...b;en-us;Q309338 - very handy! but then this is microsoft

they suggest you use a html control instead - i.e. just add the runat="server" to your bog standard select tag - will this let you do what you want? you can still dynamically load this list from a database etc and set the styles at runtime too...

Reply With Quote
  #3  
Old April 21st, 2004, 02:39 PM
timandkitty timandkitty is offline
saved by grace
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: kansas
Posts: 85 timandkitty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Talking muchas gracias

I don't believe that isea will work for me, as I need them to maintain state through postbacks (which they won't, right?) but thanks for the information. At least I can resign myself to dysfunctionality of style for the time-being.

Reply With Quote
  #4  
Old April 21st, 2004, 03:36 PM
fizzy's Avatar
fizzy fizzy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Dublin, Ireland
Posts: 100 fizzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 5 sec
Reputation Power: 6
well like i say i'm new to this stuff... but on doing a quick test the select seemed to remember everything about itself post after post for me??

Reply With Quote
  #5  
Old April 21st, 2004, 04:59 PM
timandkitty timandkitty is offline
saved by grace
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: kansas
Posts: 85 timandkitty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
cool

I'll try it out. Thanks mucho, Leprechan Amigo.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > VB: CSS Styles on ddl listitems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT