求助:repeater控件中使用checkbox的问题
我用repeater控件绑定了一组数据,里面包括checkbox控件,当我把其中的一条记录选后,点更新按钮时,提示错误信息:“未将对像设置引用到实例”
Private Sub btnupdate _Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate .Click
Dim c As Control
For Each c In Me.Repeater1.Controls
Dim check As CheckBox = CType(c.FindControl("CheckBox1"), CheckBox)
If check.Checked = True Then
Dim strsql As String = "update maillist set MFlag='d'"
Dim cmd As New SqlCommand(strsql, conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
End If
Next c
End Sub
请问该如何解决啊? 先谢谢各位了~~~~