0
在我的aspx页面上,我有一个gridview模板,它在呈现时具有100-200行,每行都有一个复选框。不会将更新后的复选框从gridview添加到arraylist
当页面加载时5自动检查复选框。如果我手动检查另一个3,然后按提交按钮,然后遍历所有gridview行,找出哪些行有一个复选框,然后它仍然记得原来的5.我怎样才能让它记住更新的8?
Protected Sub mySubmitButton_Click(sender As Object, e As EventArgs)
Dim myArray As ArrayList = New ArrayList()
For Each myRow As GridViewRow In MyGridview.Rows
If CType(myRow.FindControl("MyCheckbox"), CheckBox).Checked Then
myArray.Add(MyGridview.DataKeys(MyRow.RowIndex).Value)
End If
Next
'add to DB myArray
End Sub
我想这对在asp.net GridView和它没有什么区别
ViewStateMode="Disabled" and ViewStateMode="Enabled"
感谢您的帮助
你能解释一下吗?什么是视图状态?感谢 –
[点击此处](http://msdn.microsoft.com/en-us/library/ms972976.aspx)了解ViewState。 – Jaypal