Each item in the CheckBoxList
is a ListItem
object. These don't inherit from Control
so they don't have their own ControlCollection property. This means you can't add a LinkButton or Button
to the item(s).
If it was based on a Control
object, you'd be able to hook into the OnDataBound
event of the CheckBoxList
, and iterate through the items until you find the one that needs the button. From there you'd be able to add the control (button) to the individual item's item.Controls
collection. But you're going to be pretty limited for the ListItem because it doesn't have this functionality.
What does the details button do? If it's simply a client-side button, you could maybe inject html into the Text property of the ListItem
, although I haven't verified this works:
foreach (ListItem item in myCheckBoxList)
{
item.Text += " <input type=\"button\"/>";
}
Either way it won't be pretty, and you might be better to create a simple user control. In the control you could still use a CheckBoxList, but you could add HyperLink or Buttons to the UserControl dynamically. You could use CSS or other means to lay out the button in the right spot.