After a button is clicked the trace writes false for the .checked value of all the checkboxes, even if they are checked. Im guessing that the page load event fires before the rest of the code. So it resets the checkboxes. Is there any work around for this
Here is the code.
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim DGItem As DataGridItem
Dim cmdText As String
Dim chkBox As System.Web.UI.WebControls.CheckBox
For Each DGItem In dg.Items
chkBox = DGItem.Cells(0).FindControl("checkboxSelect"
Trace.Write("Checked", chkBox.Checked)
Next
End Sub
Here is the code.
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim DGItem As DataGridItem
Dim cmdText As String
Dim chkBox As System.Web.UI.WebControls.CheckBox
For Each DGItem In dg.Items
chkBox = DGItem.Cells(0).FindControl("checkboxSelect"
Trace.Write("Checked", chkBox.Checked)
Next
End Sub