J
Jamie Sutherland
Hi,
I have a datagrid which has 3 coloumns adn about 10 rows. The Coloumns have
the following fields one is a (chkPrimary) checkbox field and another is
a(lblAccountID) Label field and the other is (lblAccountName) Label field.
I need to have these cheboxes ticked if the lblAccountID value is in another
table. Below is the code so far but does not work. any help please...
Thanks
Jamie
Dim dgItems As DataGridItem
Dim chkselected As CheckBox
Dim cmdGroups As New SqlCommand("SELECT AccountType_ID, Username,
PrimaryGroup from Group_memberShip Where" & _
" username = '" & userID & "' and (PrimaryGroup =1)", conn)
conn.Open()
dr = cmdGroups.ExecuteReader
Do While dr.Read
For Each dgItems In dgGroups.Items
chkselected = CType(dgItems.FindControl("chkPrimary"), CheckBox)
If dr("AccountType_ID") Is CType(dgItems.FindControl("lblAccountID"), Label)
Then
chkselected.Checked = True
End If
Next
Loop
dr.Close()
conn.Close()
I have a datagrid which has 3 coloumns adn about 10 rows. The Coloumns have
the following fields one is a (chkPrimary) checkbox field and another is
a(lblAccountID) Label field and the other is (lblAccountName) Label field.
I need to have these cheboxes ticked if the lblAccountID value is in another
table. Below is the code so far but does not work. any help please...
Thanks
Jamie
Dim dgItems As DataGridItem
Dim chkselected As CheckBox
Dim cmdGroups As New SqlCommand("SELECT AccountType_ID, Username,
PrimaryGroup from Group_memberShip Where" & _
" username = '" & userID & "' and (PrimaryGroup =1)", conn)
conn.Open()
dr = cmdGroups.ExecuteReader
Do While dr.Read
For Each dgItems In dgGroups.Items
chkselected = CType(dgItems.FindControl("chkPrimary"), CheckBox)
If dr("AccountType_ID") Is CType(dgItems.FindControl("lblAccountID"), Label)
Then
chkselected.Checked = True
End If
Next
Loop
dr.Close()
conn.Close()