Click here to Skip to main content
15,880,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a checkboxlist

<asp:CheckBoxList id="check1" AutoPostBack"True" TextAlign"Right" OnSelectedIndexChanged="Check" runat"server">




And the function:

Sub Check(ByVal sender As Object, ByVal e As EventArgs)
Dim sql As String
If check1.SelectedItem.Selected = True Then[code]....

The error is: Object reference not set to an instance of an object. Is there a better way to check if a list item is checked or unchecked?
Posted
Updated 27-Sep-22 2:19am

1 solution

Try the following

C#
if (Checkboxlist1.Items[Index].Selected)
            {
                Response.Write("Try this");
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900