Results 1 to 17 of 17

Thread: [CASE CLOSED] Displaying in checkboxes.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Resolved [CASE CLOSED] Displaying in checkboxes.

    Hi,

    I've got a table and a column called "Servers". How can I get each of the server and then display each of them in check box?

    Example:

    Server 1 [checkbox]
    Server 2 [checkbox]
    .
    .
    .
    .
    Server 10 [checkbox]

    Regards,
    Roger
    Last edited by Aka Roger; Apr 26th, 2006 at 08:45 PM.
    Appreciated all helps given. Thanks Guys!

  2. #2
    Junior Member
    Join Date
    Mar 2006
    Posts
    25

    Re: Displaying in checkboxes.

    How about bind the table with CheckBoxList?
    Help Me Help You.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Ya.. I've just discovered it.. Thanks a lot dude.

    But another problem seems to appear now.
    You see, in my page, there are dropdown list box and check boxes.

    Dropdown list box contains all about software.
    Checkbox list contains all servers.

    However, what I want is that when a person clicks on the selected software, the checkbox list will then do a SQL command to search for Server that is using the software. Is there anyway to make it work? I've got no ideas at all.

    Regards,
    Roger
    Appreciated all helps given. Thanks Guys!

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    I know that I need to cater coding to detect what the user has selected in the drop down list. But how do I do it? Can anyone guide me?
    Appreciated all helps given. Thanks Guys!

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Displaying in checkboxes.

    The dropdownlist has a SelectedIndexChanged event in which you can read the selected value and then populate the checkboxlist depending upon that value. Is that what you were looking for?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Ya... I've tried to use SelectedIndexChange.. But it does not run at all. When I insert break point, it simply skipped through the SelectedIndexChange event.
    Appreciated all helps given. Thanks Guys!

  7. #7
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: Displaying in checkboxes.

    Do you have the AutoPostBack property set to True for the dropdownlist?

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Ya. I've got it to work. But why must I set the autopost back?
    Can anyone please explain?
    Appreciated all helps given. Thanks Guys!

  9. #9
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: Displaying in checkboxes.

    did the AutoPostBack fix the problem?

    When the AutoPostBack property is true for a dropdownlist, the page posts back to the server when the index is changed, allowing you to carry any values with it. you can actually see the behavior when it occurs because the page 'reloads' itself in a way. give it a try (with AutoPostBack set to True of course)

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Yes, the auto post back fixed everything. But how do I write a loop to check if the check boxes are checked. If the check box is checked, then it will add into the database.

    Regards,
    Roger
    Appreciated all helps given. Thanks Guys!

  11. #11
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: Displaying in checkboxes.

    Do you have checkboxes in your DropDownList? i didn't think you could do that in webforms Or do you have a checkbox list?

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Sorry if I did not make things clear. I've got a checkbox list and how do I do a loop to check which checkbox is checked.
    Appreciated all helps given. Thanks Guys!

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: Displaying in checkboxes.

    Oh I found it. More information can be found here
    Appreciated all helps given. Thanks Guys!

  14. #14
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: [CASE CLOSED] Displaying in checkboxes.

    Thats cool. I didn't reread the earlier posts

    Try this to itterate through the checkboxes:

    VB Code:
    1. dim i as integer
    2. For i = 0 To CheckBoxList1.Items.Count - 1
    3.              If CheckBoxList1.Items(i).Selected Then
    4.                 'code here
    5.              End If
    6. Next
    Last edited by drpcken; Apr 26th, 2006 at 08:51 PM.

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

  15. #15
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: [CASE CLOSED] Displaying in checkboxes.

    Ahh good job!

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    204

    Re: [CASE CLOSED] Displaying in checkboxes.

    Thanks a lot dude.
    Appreciated all helps given. Thanks Guys!

  17. #17
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Re: [CASE CLOSED] Displaying in checkboxes.

    Anytime friend!

    In the unlikely event that I answer your question correctly, please Rate my post

    Using Visual Studio 2005 Professional

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width