I am getting the followin error:
here is my code:
The error is appearing on this line:
Code:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
here is my code:
Code:
Protected Sub btnRequestFiles_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRequestFiles.Click
For Each item As GridDataItem In RadGrid1.SelectedItems
Dim conFiles As SqlConnection
Dim strConnection As String
Dim cmd As New SqlCommand
Dim cmdinsert As SqlCommand
Dim strInsert As String
strConnection = ConfigurationManager.ConnectionStrings("FileawaySQLConnectionString").ConnectionString
conFiles = New SqlConnection(strConnection)
conFiles.Open()
cmd.Connection = conFiles
cmd.CommandText = "UPDATE dbo.Files SET FileStatus = 2 WHERE FileID = '" + RowID.ToString() + "'"
cmd.ExecuteNonQuery()
conFiles.Close()
Me.lblRequestSuccessful.Text = "Files requested successfully"
RadGrid1.Rebind()
'conFiles = New SqlConnection(strConnection)
' strInsert = "INSERT INTO dbo.FileHistory (FileID, Action) VALUES (@RowID, @Action)"
' cmdinsert = New SqlCommand(strInsert, conFiles)
' cmdinsert.Parameters.AddWithValue("@RowID", RowID)
' cmdinsert.Parameters.AddWithValue("@Action", 2)
' conFiles.Open()
'cmdinsert.ExecuteNonQuery()
'conFiles.Close()
Next
End Sub
The error is appearing on this line:
Code:
Dim RowID As String = item.GetDataKeyValue("FileID")