Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox checked property in datagrid always returns false

Status
Not open for further replies.

asmith555

Programmer
Oct 7, 2002
97
US
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
 
Make sure your data loading code in your page_load event is in a If not IsPostBack Block That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top