0

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

3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by ema005
0

Change If ckbox.Selected = True Then to If ckbox.Checked Then I think that's what you want.

HTH

0

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'

0

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

0

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

0

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

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.