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

Adding attribute for each item in a checkbox list control

How can i add a user define attribute to each checkbox
item in a checkbox list control.
I want to add a attribute "Tag".
Is it possible
Nov 19 '05 #1
3 9946
Vikram:
Not that I know of :( the ListItem (which is what each individual item is)
ignores the Attributes collection...

You could create your own CheckBoxList which extends the existing
CheckBoxList in a custom server control. You can check out how it was done
with this "special" DropDownList:
http://weblogs.asp.net/fmarguerie/ar...2/27/3103.aspx

Should be somewhat helpful...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"vikram" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
How can i add a user define attribute to each checkbox
item in a checkbox list control.
I want to add a attribute "Tag".
Is it possible

Nov 19 '05 #2
Vikram,
I did for other controls (like datagrid, repeater, etc) and you may be able
to do with similar approach. Here is an outline-
You can intercept each Item of ListItemCollection (a collection of ListItem
object) in the collection in DataBinding event.

Then, you can add any attribute of your choice to the ListItem
object(ListItem.Attributes.Add...)

Thanks,
Prodip
www.aspnet4you.com
"vikram" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
How can i add a user define attribute to each checkbox
item in a checkbox list control.
I want to add a attribute "Tag".
Is it possible

Nov 19 '05 #3
Are you sure this approach works for ListItem? I agree that it works fine
for other controls, but I'm 99% sure that it doesn't work for
ListItems...try it...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Prodip Saha" <ps***@bear.com> wrote in message
news:ew**************@tk2msftngp13.phx.gbl...
Vikram,
I did for other controls (like datagrid, repeater, etc) and you may be able to do with similar approach. Here is an outline-
You can intercept each Item of ListItemCollection (a collection of ListItem object) in the collection in DataBinding event.

Then, you can add any attribute of your choice to the ListItem
object(ListItem.Attributes.Add...)

Thanks,
Prodip
www.aspnet4you.com
"vikram" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
How can i add a user define attribute to each checkbox
item in a checkbox list control.
I want to add a attribute "Tag".
Is it possible


Nov 19 '05 #4

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

Similar topics

2
by: John R. | last post by:
I want to have a listbox that shows a checkbox and a textbox. I created a user control that has a checkbox and a textbox in it and have been trying to add it to a listbox but I can't get it to...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: Stephen Lambie | last post by:
Hi, I want to develop a custom checkbox. I want to use the existing checkbox in a custom control where I use the disabled state as a third state. I need to be able to detect mouse or click...
1
by: darkpeace | last post by:
Okay i'm at my wits end. I've tried every which way to add a simple onClick even to checkbox items in my code behind : example: Protected WithEvents chkSample As...
3
by: Gummy | last post by:
Hello, I know I can use a Checkboxlist or a RadioButtonList to easily create a list based on the data passed to it. But using what if I wanted to use the same data and based on the data,...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
0
by: djarmoluk | last post by:
I have a RadioButtonList (named rbAnswers) control within a repeater control. When binding to the repeater, I am trying to add an "OnChange" attribute to the individual list item controls (input...
0
by: Kevin Blount | last post by:
I need to create a page that lists a users Content, and allow them to add subscribers to or remove subscribers from that Content. The list may contain just one Content item, but it could just as...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.