只在将检查的checkboxstatus添加到gridview时遇到问题。
受保护的子atasks_Click(ByVal sender As Object,ByVal e As System.EventArgs) Dim tasknamelist As New List(Of Boolean)
For Each row As GridViewRow In GridView1.Rows
' Selects the text from the TextBox
Dim checkboxstatus As CheckBox = CType(row.FindControl("tasknamebox"), CheckBox)
tasknamelist.Add(checkboxstatus.Checked)
Next
GridView2.DataSource = tasknamelist
GridView2.DataBind()
UpdatePanel2.Update()
End Sub
答案 0 :(得分:1)
GridView1.Rows(0)
应该是row
(正如您所声明的那样)
tasknamelist = checkboxstatus.Checked
错误,你将bool分配给列表,试试这个:
Dim tasknamelist As New List(Of Boolean)
tasknamelist.Add(checkboxstatus.Checked)