v-jetan
2/21/2004 1:52:00 AM
Hi Patrick,
Sorry for letting you wait so long time.
I have reviewed your VB.net code, I think the problem code snippet should
be:
For Each dgi In dgDefects.Items
Dim tc As TableCell = dgi.Cells(7)
Dim c As Control
For Each c In tc.Controls
Dim Discon As Boolean = CType(e.Item.FindControl("dgDetails"),
CheckBox).Checked
If TypeOf (c) Is System.Web.UI.WebControls.CheckBox Then
Dim cb As CheckBox = CType(c, CheckBox)
If cb.Checked = True Then
Me.Response.Write("The " & dgi.ItemIndex.ToString() & "th
row is selected<br>")
End If
End If
Next c
Next dgi
In the code, I think "dgDetails" is the id of the details datagrid. But in
your code, you find this control and convert it into CheckBox, which is not
correct.
I think you should first find the details datagrid, then loop through all
the rows in the DETAILS datagrid and find the CheckBox. Like this(Note: I
did not compile this code at my side, so there may be some small error in
the code):
For Each dgi In dgDefects.Items
Dim tc As TableCell = dgi.Cells(7)
Dim c As Control
For Each c In tc.Controls
If TypeOf (c) Is System.Web.UI.WebControls.DataGrid Then
Dim dgdetails As DataGrid =
CType(e.Item.FindControl("dgDetails"), DataGrid)
Dim dgi as DataGridItem
For Each dgi in dgdetails Then
If(CType(dgi.FindControl("checkboxid"),
CheckBox).Checked = True)
Me.Response.Write("The " &
dgi.ItemIndex.ToString() & "th row is selected in Details DataGrid<br>")
End If
Next di
End If
Next c
Next dgi
Also, in your program logic in your code snippet, you hook into the MASTER
datagrid's ItemCommand event, then want to loop through the DETAILS
datagrid's each row and collect any selected checkbox items. I think this
is a strange logic, because the DETAILS datagrid may still be invisible,
but you continue loop through the invisible DETAILS datagrid.
Have you received my sample code project ?
In that project, I use an individual button, in which click event, I show
all the checked items in VISIBLE details datagrid.
================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.