You can do a batch update.
something like:
Dim dg As DataGridItem
Dim ck As CheckBox
Dim UserID As Label
For Each dg In yourdatagrid.Items
ck = dg.FindControl("yourcheckboxname")
UserID = dg.FindControl("yourdatakeyfield")
If ck.Checked = True Then
UpdateUserHistory(UserID.Text, 1)
Else
UpdateUserHistory(UserID.Text, 0)
End If
Next
and then you can define the function on UpdateUserHistory...
HTH,
Irene
> Using Visual studio.net VB
>
[quoted text clipped - 9 lines]
>
> any solutions out there???
Wolffang - 30 Oct 2004 17:59 GMT
Thank you for your answer...
This is what i have so far.... but i am geting an error.... where the OrderID is not being passed from the datagrid "dgOrders" to the stored procedure... but the checkbox is working... is this because i am using FindControl???
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim dg As DataGridItem
Dim ck As CheckBox
Dim OrdID As Label
Me.SqlConnection1.Open()
For Each dg In dgOrders.Items
ck = dg.FindControl("chkSelect")
OrdID = dg.FindControl("OrderID")
If ck.Checked = True Then
Me.SqlCommand1.Parameters("@OrderID").Value = OrdID
Me.SqlCommand1.Parameters("@AdminUserName").Value = lblUserName.Text
Me.SqlCommand1.Parameters("@AdminProcess").Value = 1
Me.SqlCommand1.ExecuteNonQuery()
End If
Next
Me.SqlConnection1.Close()
End Sub