CheckBoxList

Discussion in 'ASP .Net Web Controls' started by Terry Holland, Aug 2, 2005.

  1. 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
    Terry Holland, Aug 2, 2005
    #1
    1. Advertising

  2. 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" <>
    | 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: <>
    | 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
    |
    |
    |
    Steven Cheng[MSFT], Aug 3, 2005
    #2
    1. Advertising

  3. 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


    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > 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" <>
    > | 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: <>
    > | 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
    > |
    > |
    > |
    >
    Terry Holland, Aug 3, 2005
    #3
  4. 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" <>
    | References: <>
    <>
    | 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: <#>
    | 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
    |
    |
    | "Steven Cheng[MSFT]" <> wrote in message
    | news:...
    | > 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" <>
    | > | 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: <>
    | > | 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
    | > |
    | > |
    | > |
    | >
    |
    |
    |
    Steven Cheng[MSFT], Aug 4, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francois Verbeeck
    Replies:
    0
    Views:
    1,884
    Francois Verbeeck
    Jun 24, 2003
  2. Khan Imran

    Re: checkboxlist control

    Khan Imran, Jun 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    454
    Khan Imran
    Jun 30, 2003
  3. Ignacio Martinez

    Re: checkboxlist control

    Ignacio Martinez, Jun 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    449
    Ignacio Martinez
    Jun 30, 2003
  4. JD
    Replies:
    5
    Views:
    11,649
    NetArchitect
    Aug 8, 2007
  5. Patrick.O.Ige
    Replies:
    5
    Views:
    19,105
    Patrick.O.Ige
    Jun 19, 2005
Loading...

Share This Page