shahid
Mar 9th, 2006, 05:40 AM
hi,
how can i put checkboxes/radio buttons in objectlist
i m building a mobile page, where data shows like:
Grade1 [ ] [ ]
grade2 [ ] [ ]
grade3 [ ] [ ]
[] shows as check box
if i try simple checkboxlist (selection list) it's shows the boxes in 2 lines
any idea?
plz help
Shaggy Hiker
Mar 10th, 2006, 01:46 PM
In general, the CF is stripped down. The key is to make the process function the way that feels right, even if you are doing something really strange in the background. This looks like an excellent place for something strange.
I assume that you are creating a list that might require scrolling (like a listbox). If that assumption is false, some of what I am going to suggest will be overblown, but it will still work.
You have limited list options in the CF, and to make something that works the way you want, you sometimes have to roll your own. The way I would do what you are doing would be to put a panel on the form of the size you want the listbox to be. I would then put a scroll bar on the panel such that it looks like a listbox.
Next, I would add a series of small panels onto the big panel with the same color as the big panel. Onto each small panel I would add a label, and two checkboxes.
In the background I would have a class which contained an array (or a list of any other sort), and any other information needed. This is not absolutely necessary, the array could be a member of the form just as easily.
Whenever the scroll bar was moved, I would populate the labels based on the value of the scroll bar. Thus if the scroll bar value was 0, I would populate the labels starting with index 0. If the scroll bar value was 10, I would populate the labels starting with array index 10.
Come to think of it, the smaller panels may not add any value. I used that same design to make a multi-select listbox, where I needed the smaller panels so that each label could respond to a click event (labels don't, but panels do). You may not need that functionality.
Would that work?