E
Eric
I have a checkbox column in a datagrid so a user can select (by checking)
mulitple items then hit a submit button to add them. The problem is that I
try to evaluate (xxx.checked = true) but it is always equal to false.
The checkbox column appears to have no clue that a box is indeed checked.
I've set breakpoints and watched i =
(however many units) a thousand times. But chkADD.checked NEVER equals true
even though I now the item is checked.
Here is the code for the sub:
Sub AddBooksChecked()
Dim CProdVB As IMN.Data.CustomProductsDB = New
IMN.Data.CustomProductsDB()
Dim iBookID As Integer = CInt(ViewState("iBookID"))
' Iterate through all rows within the list
Dim i As Integer
Dim iCounter As Integer = 0
For i = 0 To CProductgrid.Items.Count - 1
' Obtain references to row's controls
Dim chkADD As CheckBox =
CType(CProductgrid.Items(i).FindControl("AddMe"), CheckBox)
Try
If chkADD.Checked = True Then 'this at the moment is
NEVER true
iCounter = iCounter + 1
Dim lblDocID As Label =
CType(CProductgrid.Items(i).FindControl("DocID"), Label)
CProdVB.AddTOCItem(iBookID, lblDocID.Text)
End If
Catch
MyMsg.Text = "There has been a problem with one
or more of your inputs."
Finally
MyMsg.Text = iCounter & " documents were added
to your open book."
End Try
Next
MyMsg.Visible = True
End Sub
If anyone could give some directions on where to look for the problem, it
would be greatly appreciated.
mulitple items then hit a submit button to add them. The problem is that I
try to evaluate (xxx.checked = true) but it is always equal to false.
The checkbox column appears to have no clue that a box is indeed checked.
I've set breakpoints and watched i =
(however many units) a thousand times. But chkADD.checked NEVER equals true
even though I now the item is checked.
Here is the code for the sub:
Sub AddBooksChecked()
Dim CProdVB As IMN.Data.CustomProductsDB = New
IMN.Data.CustomProductsDB()
Dim iBookID As Integer = CInt(ViewState("iBookID"))
' Iterate through all rows within the list
Dim i As Integer
Dim iCounter As Integer = 0
For i = 0 To CProductgrid.Items.Count - 1
' Obtain references to row's controls
Dim chkADD As CheckBox =
CType(CProductgrid.Items(i).FindControl("AddMe"), CheckBox)
Try
If chkADD.Checked = True Then 'this at the moment is
NEVER true
iCounter = iCounter + 1
Dim lblDocID As Label =
CType(CProductgrid.Items(i).FindControl("DocID"), Label)
CProdVB.AddTOCItem(iBookID, lblDocID.Text)
End If
Catch
MyMsg.Text = "There has been a problem with one
or more of your inputs."
Finally
MyMsg.Text = iCounter & " documents were added
to your open book."
End Try
Next
MyMsg.Visible = True
End Sub
If anyone could give some directions on where to look for the problem, it
would be greatly appreciated.