Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to group CheckboxList?

Reply
Thread Tools

How to group CheckboxList?

 
 
Egbert
Guest
Posts: n/a
 
      11-03-2004
I use a System.Web.UI.WebControls.CheckBoxList object to fill a list.

I need to label groups of checkboxes in the list by Category (Determined
dynamically from the database) at runtime.

Is it possible to group checkboxes in 1 CheckboxList?

Something like this:

*************************

Category 1
-checkbox1
-checkbox2

Category 2
-checkbox3
-checkbox4

Category 3
-checbox5

*************************



 
Reply With Quote
 
 
 
 
Justin Rogers
Guest
Posts: n/a
 
      11-03-2004
There isn't any default grouping. You'd have to customize the control's
rendering
in order to provide this feature. Won't be exceptionally easy to do this using
the
existing control, so you might want to create your own control.


--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Egbert" <a> wrote in message
news:4188ac78$0$21253$(E-Mail Removed) et...
>I use a System.Web.UI.WebControls.CheckBoxList object to fill a list.
>
> I need to label groups of checkboxes in the list by Category (Determined
> dynamically from the database) at runtime.
>
> Is it possible to group checkboxes in 1 CheckboxList?
>
> Something like this:
>
> *************************
>
> Category 1
> -checkbox1
> -checkbox2
>
> Category 2
> -checkbox3
> -checkbox4
>
> Category 3
> -checbox5
>
> *************************
>
>
>



 
Reply With Quote
 
 
 
 
Egbert
Guest
Posts: n/a
 
      11-03-2004
You mean by using a Repeater or Datagrid?

But then it is difficult to determine which boxes are checked, and which
aren't, when you want to persist de results.

In case of 1 checkboxlist, you can loop through the items of the
checkboxlist.

I also tried to group de checkboxes by giving them the same name, like in
HTML, but that doesn't seem to be possible with <asp:checkbox> elements.


"Justin Rogers" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> There isn't any default grouping. You'd have to customize the control's
> rendering
> in order to provide this feature. Won't be exceptionally easy to do this
> using the
> existing control, so you might want to create your own control.
>
>
> --
> Justin Rogers
> DigiTec Web Consultants, LLC.
> Blog: http://weblogs.asp.net/justin_rogers
>
> "Egbert" <a> wrote in message
> news:4188ac78$0$21253$(E-Mail Removed) et...
>>I use a System.Web.UI.WebControls.CheckBoxList object to fill a list.
>>
>> I need to label groups of checkboxes in the list by Category (Determined
>> dynamically from the database) at runtime.
>>
>> Is it possible to group checkboxes in 1 CheckboxList?
>>
>> Something like this:
>>
>> *************************
>>
>> Category 1
>> -checkbox1
>> -checkbox2
>>
>> Category 2
>> -checkbox3
>> -checkbox4
>>
>> Category 3
>> -checbox5
>>
>> *************************
>>
>>
>>

>
>



 
Reply With Quote
 
Justin Rogers
Guest
Posts: n/a
 
      11-03-2004
The CheckBoxList actually gives each checkbox a unique number
based on index. They are doing some work. The point is, if you
want this feature, you are going to have to get an existing control
or write your own logic.

ListControl is a good base class to start from. Or CheckBoxList
if you just override the rendering logic. Otherwise, you could use
your own Repeater, since that is pretty much what the CheckBoxList
does already.


--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Egbert" <a> wrote in message
news:4188ba1d$0$21255$(E-Mail Removed) et...
> You mean by using a Repeater or Datagrid?
>
> But then it is difficult to determine which boxes are checked, and which
> aren't, when you want to persist de results.
>
> In case of 1 checkboxlist, you can loop through the items of the checkboxlist.
>
> I also tried to group de checkboxes by giving them the same name, like in
> HTML, but that doesn't seem to be possible with <asp:checkbox> elements.
>
>
> "Justin Rogers" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> There isn't any default grouping. You'd have to customize the control's
>> rendering
>> in order to provide this feature. Won't be exceptionally easy to do this
>> using the
>> existing control, so you might want to create your own control.
>>
>>
>> --
>> Justin Rogers
>> DigiTec Web Consultants, LLC.
>> Blog: http://weblogs.asp.net/justin_rogers
>>
>> "Egbert" <a> wrote in message
>> news:4188ac78$0$21253$(E-Mail Removed) et...
>>>I use a System.Web.UI.WebControls.CheckBoxList object to fill a list.
>>>
>>> I need to label groups of checkboxes in the list by Category (Determined
>>> dynamically from the database) at runtime.
>>>
>>> Is it possible to group checkboxes in 1 CheckboxList?
>>>
>>> Something like this:
>>>
>>> *************************
>>>
>>> Category 1
>>> -checkbox1
>>> -checkbox2
>>>
>>> Category 2
>>> -checkbox3
>>> -checkbox4
>>>
>>> Category 3
>>> -checbox5
>>>
>>> *************************
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Multiple isakmp policies (Group 1 and Group 2) rmcnutt Cisco 1 07-13-2004 09:33 PM
Re: Which group is the PC discussion group (like comp.sys.mac.----)? philo Computer Support 0 08-03-2003 11:41 AM
Re: Which group is the PC discussion group (like comp.sys.mac.----)? LooseLips Computer Support 0 08-03-2003 08:37 AM



Advertisments