checkbox in datagrid problem

sconard

New member
Joined
Dec 2, 2003
Messages
3
I have a datagrid that has a checkbox column defined:
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email" Visible="True">
<ItemTemplate>
<asp:CheckBox ID="cbEmailed" Runat="server">
</asp:CheckBox>
</ItemTemplate>

</asp:TemplateColumn>

I have a function (called on page load for testing) to check for the values as changed by the user:

For Each dgi In myDataGrid.Items
Dim myCheckbox As CheckBox = CType(dgi.Cells(6).Controls(1), CheckBox)
If myCheckbox.Checked Then
do the work
End If
Next




This function never shows values changed by the user. Only the values as set originally by databind of the grid.

For Each dgi In myDatagrid.Items
Dim myCheckbox As CheckBox = CType(dgi.Cells(6).Controls(1), CheckBox)
If CBool(getChecked(CInt(dgi.Cells(0).Text), jobId)) Then
myCheckbox.Checked = True
Else
myCheckbox.Checked = False
End If
Next

I have confirmed that the databind is not called prior to the check of existing values.

Any ideas as to why and examples as how to fix?



Thanks
 
Back
Top