473,396 Members | 1,872 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.

Adding attributes to items in a dropdown list

Hey again,

Anybody have any ideas about how I would go about adding attributes to the
listitems in a databound dropdownlist?

Asp.net debugger has kindly informed me that dropdown list is not a
collection so that 'for each listitem in dropdownlist' style code won't
work.

Joe
Nov 18 '05 #1
3 2616
Hi...

Use HtmlSelect control instead of DropDownList...

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
Hey again,

Anybody have any ideas about how I would go about adding attributes to the
listitems in a databound dropdownlist?

Asp.net debugger has kindly informed me that dropdown list is not a
collection so that 'for each listitem in dropdownlist' style code won't
work.

Joe

Nov 18 '05 #2
That kinda takes from the convenience of the databinding - I don't want to
have to loop through and add values - does anyone know off the top of their
heads is there an onItemCreate method like that for datalists and datagrids?

Joe
"Eugene Jenihov" <eu****@dotsite.spb.ru> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi...

Use HtmlSelect control instead of DropDownList...

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
Hey again,

Anybody have any ideas about how I would go about adding attributes to the listitems in a databound dropdownlist?

Asp.net debugger has kindly informed me that dropdown list is not a
collection so that 'for each listitem in dropdownlist' style code won't
work.

Joe


Nov 18 '05 #3
There is an event fired by DataGrids called ItemDataBound. You might
be able to catch this event and then add your attribute there.

Neil

"Joe Molloy" <mo********@hotmail.com> wrote in message news:<Ok**************@tk2msftngp13.phx.gbl>...
That kinda takes from the convenience of the databinding - I don't want to
have to loop through and add values - does anyone know off the top of their
heads is there an onItemCreate method like that for datalists and datagrids?

Joe
"Eugene Jenihov" <eu****@dotsite.spb.ru> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi...

Use HtmlSelect control instead of DropDownList...

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
Hey again,

Anybody have any ideas about how I would go about adding attributes to the listitems in a databound dropdownlist?

Asp.net debugger has kindly informed me that dropdown list is not a
collection so that 'for each listitem in dropdownlist' style code won't
work.

Joe


Nov 18 '05 #4

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

Similar topics

5
by: Tim | last post by:
I have block of code adding values to dropdown list under if (!Page.IsPostBack) { adding items } else { refreshing data }
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
0
by: Frawls | last post by:
Hi, This is concerned with System.Web.UI.WebControls.DropDownList I am having problems creating a method which will remove list items from a preloaded dropdownlist. This dropdown is loaded...
5
by: Kay | last post by:
Hello, I have two list boxes on my form, one initially displays with items and the other displays blank, by clicking a button, it is possible to move items from one box to another and vice a...
2
by: Shiju Poyilil | last post by:
Hi ! I have a requirement wherein i am binding a datalist which contains a label (Caption for the field) and some literal hidden fields and a dropdown list. When I am binding to the datalist.....
2
by: estafford | last post by:
I have a dropdownlist control that is filled using a database query. I also want to add an additional option to the list that is not pulled from the database. How can I go about doing that? ...
2
by: Bruno Alexandre | last post by:
Hi guys, I'm using Javascript to dynamically add to a dropdown values like for ( i=0; i<tv.length; i++ ) { selectDDAvisCtrl.options = new Option(tv, tv); } and I use ...
0
by: JP | last post by:
I have a .NET Dropdown list control that get populated with several ITEMS from a database. In addition, each of those items get populated with additional attributes via this syntax: (assume that...
1
by: mitchman10 | last post by:
My Time table has TimeID,Employee,PayPeriod,ChargeCodeID,Hours My Chargecode table has ChargecodeID,c_Text I need an Editable datagrid that will show the TimeID,Employee,PayPeriod,C_Text in a...
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
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
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,...

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.