CheckBoxList

T

Terry Holland

I have a webform with a checkboxlist control on it. This control is used to
indicate which 'child' objects are related to a 'parent' object. I assign
by ticking and un-assign by unticking and then save the changes back to my
database. This is all working well but I now want to add some extra
functinality. Users need to be able to select an item in the checkboxlist
and move it up or down. Is this achievable using the checkbox list? ie can
I highlight the selected item in list and then move it up or down in the
list? I cant see any properties that would indicate that the selected item
can be highlighted or that I can indicate the position in the list that I
want to add the item.

tia

Terry Holland
 
S

Steven Cheng[MSFT]

Hi Terry,

Welcome to ASP.NET newsgroup.
REgarding on the CheckBoxList control's move item postion problem, here are
some of my understanding and suggestions:

1. For CheckedBoxList, it's can be populated either through manually adding
ListItems into its Items collection or using databinding to fill it. After
either approach, the binded items will be persisted in ViewState. And in
serverside code we can use its "Items" collection to find a certain item
and remove it or add new item.
So for your question, move items up/down, I think it's possible, since we
can remove a certain item first and use "insert" method to insert it to a
new position (through the index parameter ).

2. Based on the means I mentioned in #1, we can move up/down items in
checkedboxlist(of course, we need to carefully caculate the old/ new index
of the item we want to manipulate). Another problem here is that how can
we mark the item the use select to move, since the checkedboxList control
dosn't be designed to support this function, we may need to do some further
jobs to achieve it. For example, we can put a hidden field (<input
type="hidden" ...>) on the page and use some client side script to log the
item's index which user want to move.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "Terry Holland" <[email protected]>
| Subject: CheckBoxList
| Date: Tue, 2 Aug 2005 12:14:26 +0100
| Lines: 16
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: host202.multiserv.com 194.200.135.202
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10226
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I have a webform with a checkboxlist control on it. This control is used
to
| indicate which 'child' objects are related to a 'parent' object. I assign
| by ticking and un-assign by unticking and then save the changes back to my
| database. This is all working well but I now want to add some extra
| functinality. Users need to be able to select an item in the checkboxlist
| and move it up or down. Is this achievable using the checkbox list? ie
can
| I highlight the selected item in list and then move it up or down in the
| list? I cant see any properties that would indicate that the selected
item
| can be highlighted or that I can indicate the position in the list that I
| want to add the item.
|
| tia
|
| Terry Holland
|
|
|
 
T

Terry Holland

I have a couple of problems with the CheckBoxList control which is leading
me to look for a more appropraite control.
Problem 1) In some instances I need to display more than one column of
information
Problem 2) The user need to be able to select a row and the control needs to
indicate which row is selected (like a list box does)

With these problems in mind, is there a control that you would suggest? The
datagrid comes to mind but I dont think this control has inbuilt ability to
allow the user to click on the a row to select & highlight and highlight
this row.

I'd appreciate advice on this

Terry Holland
 
S

Steven Cheng[MSFT]

Hi Terry,

Thanks for your response. For the further question you mentioned, IMO,
DataGrid is a good one for displayed multi-column and customized data. Also
as for selecting , of course, it has buildin select feature let a user to
select a certain row. Though it didn't support buildin selection by double
clicking a row(generally we need to put a select button or link on each row
for seelction), we can manually provide such feature through some
clientside scripts. However, the main problem is that since DATAGRID is a
template databound control which can only populate data through databinding
and didn't expose such as "Items" collection like CheckedBoxList, so we can
not discretionarily modify individual item's index in all the items within
it. Thus, it's not quite possible for you to implement the move up/down
item function on using datagrid.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "Terry Holland" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: CheckBoxList
| Date: Wed, 3 Aug 2005 10:24:25 +0100
| Lines: 104
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: host36.multiserv.com 194.200.135.36
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10250
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I have a couple of problems with the CheckBoxList control which is leading
| me to look for a more appropraite control.
| Problem 1) In some instances I need to display more than one column of
| information
| Problem 2) The user need to be able to select a row and the control needs
to
| indicate which row is selected (like a list box does)
|
| With these problems in mind, is there a control that you would suggest?
The
| datagrid comes to mind but I dont think this control has inbuilt ability
to
| allow the user to click on the a row to select & highlight and highlight
| this row.
|
| I'd appreciate advice on this
|
| Terry Holland
|
|
| | > Hi Terry,
| >
| > Welcome to ASP.NET newsgroup.
| > REgarding on the CheckBoxList control's move item postion problem, here
| are
| > some of my understanding and suggestions:
| >
| > 1. For CheckedBoxList, it's can be populated either through manually
| adding
| > ListItems into its Items collection or using databinding to fill it.
| After
| > either approach, the binded items will be persisted in ViewState. And in
| > serverside code we can use its "Items" collection to find a certain item
| > and remove it or add new item.
| > So for your question, move items up/down, I think it's possible, since
we
| > can remove a certain item first and use "insert" method to insert it to
a
| > new position (through the index parameter ).
| >
| > 2. Based on the means I mentioned in #1, we can move up/down items in
| > checkedboxlist(of course, we need to carefully caculate the old/ new
index
| > of the item we want to manipulate). Another problem here is that how
| can
| > we mark the item the use select to move, since the checkedboxList
control
| > dosn't be designed to support this function, we may need to do some
| further
| > jobs to achieve it. For example, we can put a hidden field (<input
| > type="hidden" ...>) on the page and use some client side script to log
the
| > item's index which user want to move.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: "Terry Holland" <[email protected]>
| > | Subject: CheckBoxList
| > | Date: Tue, 2 Aug 2005 12:14:26 +0100
| > | Lines: 16
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: host202.multiserv.com 194.200.135.202
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10226
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | I have a webform with a checkboxlist control on it. This control is
used
| > to
| > | indicate which 'child' objects are related to a 'parent' object. I
| assign
| > | by ticking and un-assign by unticking and then save the changes back
to
| my
| > | database. This is all working well but I now want to add some extra
| > | functinality. Users need to be able to select an item in the
| checkboxlist
| > | and move it up or down. Is this achievable using the checkbox list?
ie
| > can
| > | I highlight the selected item in list and then move it up or down in
the
| > | list? I cant see any properties that would indicate that the selected
| > item
| > | can be highlighted or that I can indicate the position in the list
that
| I
| > | want to add the item.
| > |
| > | tia
| > |
| > | Terry Holland
| > |
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top