2011-01-28 39 views
-1

只有添加checkboxstatus的選中的gridview纔有問題。我只想要添加arraylist中的選中項目

保護小組atasks_Click(BYVAL發件人爲對象,BYVALË作爲System.EventArgs) 昏暗tasknamelist作爲新的列表(布爾)

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() 

結束子

回答

1

GridView1.Rows(0)應該只是row(如你宣佈它)

tasknamelist = checkboxstatus.Checked 

是錯誤的,你分配一個布爾值的列表,試試這個:

Dim tasknamelist As New List(Of Boolean) 
tasknamelist.Add(checkboxstatus.Checked) 
+0

仍然不起作用,它說tasknamelist沒有聲明 – MyHeadHurts 2011-01-29 21:22:20

相關問題