|
-
Apr 25th, 2006, 09:51 PM
#1
Thread Starter
Addicted Member
[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! 
-
Apr 26th, 2006, 02:12 AM
#2
Junior Member
Re: Displaying in checkboxes.
How about bind the table with CheckBoxList?
-
Apr 26th, 2006, 02:19 AM
#3
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 02:28 AM
#4
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 06:20 AM
#5
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?
-
Apr 26th, 2006, 09:07 AM
#6
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 11:01 AM
#7
Fanatic Member
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 
-
Apr 26th, 2006, 08:16 PM
#8
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 08:26 PM
#9
Fanatic Member
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 
-
Apr 26th, 2006, 08:30 PM
#10
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 08:33 PM
#11
Fanatic Member
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 
-
Apr 26th, 2006, 08:35 PM
#12
Thread Starter
Addicted Member
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! 
-
Apr 26th, 2006, 08:45 PM
#13
Thread Starter
Addicted Member
Re: Displaying in checkboxes.
Oh I found it. More information can be found here
Appreciated all helps given. Thanks Guys! 
-
Apr 26th, 2006, 08:47 PM
#14
Fanatic Member
Re: [CASE CLOSED] Displaying in checkboxes.
Thats cool. I didn't reread the earlier posts 
Try this to itterate through the checkboxes:
VB Code:
dim i as integer
For i = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(i).Selected Then
'code here
End If
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 
-
Apr 26th, 2006, 08:50 PM
#15
Fanatic Member
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 
-
Apr 26th, 2006, 08:50 PM
#16
Thread Starter
Addicted Member
Re: [CASE CLOSED] Displaying in checkboxes.
Thanks a lot dude.
Appreciated all helps given. Thanks Guys! 
-
Apr 26th, 2006, 09:00 PM
#17
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|