Tim Maxey .NET Technology Blog & Resources
I was messing around with the checkbox list want simulate a dropdown list with checkboxes in it. A buddy of mine said to try the checkbox list inside a div with scroll bars. Well I did not like the scroll bar on the bottom (horizontal). So I found this:
<div style="width:300px;height:100px;overflow-x: hidden;overflow-y:scroll;overflow:-moz-scrollbars-vertical !important;">
CHECKBOX LIST HERE
</div>
Note the !important is a css hack to tell the browser which tag to use depending upon Firefox or IE.... Cool at any rate, works like a champ... Then when a user "checks" the checkbox for one or more selections, you can stick the list in an update panel and throw this into the SelectedIndexChanged event
Dim MyItem As ListItem
For Each MyItem In CheckBoxList1.Items
If MyItem.Selected = True Then
MyItem.Attributes.CssStyle.Add("color", "blue")
MyItem.Attributes.CssStyle.Add("background-color", "yellow")
End If
Next
Cool effect, highlights what was "checked...." I even went a step further and added a search box to search the list, but it's too cool to post... Keyword is bubba...