Looking for a CheckBoxList(DataBinded) in a DataList sample on the NET

  • Thread starter Patrick Olurotimi Ige
  • Start date
P

Patrick Olurotimi Ige

I have a CheckBoxList(which is Databinded) in a Datalist.
My DataBinded is done in the onItemDataBound

I'm using this method below to select the selected item in a DataBinded
CheckBoxList.

Everything works fine but when i tick a checkbox i get the error at
line:-
For i = 0 To checkboxlist1.Items.Count - 1
Object reference not set to an instance of an object.

Looking for sample or resources related.
Thanks


<asp:checkboxlist OnSelectedIndexChanged="chk_SelectedIndexChanged"
id="checkboxlist1" Runat="server" AutoPostBack="True"
</asp:checkboxlist></td>


Public Sub chk_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles checkboxlist1.SelectedIndexChanged
Dim i As Integer
For i = 0 To checkboxlist1.Items.Count - 1
If checkboxlist1.Items(i).Selected Then
Message.Text = Message.Text & checkboxlist1.Items(i).Selected &
"<br>"
Else
Message.Text = Message.Text & "false <br>"
End If
Next
End Sub
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top