954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

checkboxlist

hi !
i have made some code for a checkboxlist the items if are selected or not,and then to put them in my database.but im having a problem.even if i select my items they always apears unselected .

Dim ckbox As ListItem

        For Each ckbox In chbl.Items
            If ckbox.Selected = True Then
                objBLRegjistrimi.fnbooksubject(txtISBN.Text, chbl.SelectedValue)
            End If
        Next


'ckbox.selected' never becomes true,so never pass ' objBLRegjistrimi.fnbooksubject(txtISBN.Text, chbl.SelectedValue)'

i don't know why this happens.
thank you

Nuela
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

Change
If ckbox.Selected = True Then

to If ckbox.Checked Then

I think that's what you want.

HTH

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

Change If ckbox.Selected = True Then

to If ckbox.Checked Then

I think that's what you want.

HTH


thank you but
checked' is not a member of 'System.web.Ui.Webcontrols.checkboxlist'

Nuela
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

If the applicaion is a web applicaion check to confirm that you are rebinding to the checkboxlist at every postback.

ema005
Newbie Poster
24 posts since Jan 2006
Reputation Points: 10
Solved Threads: 4
 

sorry i mean you need to confirm that you are not rebinding at every postback.

ema005
Newbie Poster
24 posts since Jan 2006
Reputation Points: 10
Solved Threads: 4
 

yes ,it is a web application.
sorry but what does it mean,because i dont understand what you want to tell me.can you explain me better
thank you

Nuela
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

If you are binding data to the checkboxlist at the page load and the code doing the binding is not within if not ispostback. The checkboxlist will never be selected.

ema005
Newbie Poster
24 posts since Jan 2006
Reputation Points: 10
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You