Oh, ok. Next time you have an error please specify whether its occurring client side or server side. I didn't realize your problem was happening on the server.
Anyways, I'm not sure what you're trying to accomplish in your server side code here. You're probably getting the exception because the following line is returning null/nothing:
- strRecordIds = Request.Form("chkRecordId")
And then you are attempting to use the Split() method on null/nothing.
Instead of attempting to retrieve the Checked CheckBoxes using Request.Form you should loop through the GridView, using the FindControl("chkRecordId") to retrieve the check box for each row, and create your array server side (since you're using it server side).
For example:
-
Dim dr As GridViewRow
-
Dim itemsToDelete As List(Of Integer)
-
-
For Each dr In myGridView.Rows
-
Dim chkBox As CheckBox = CType(dr.FindControl("chkRecordId"), CheckBox)
-
If chkBox.Checked = True Then
-
Dim x As String = dr.Cells(1).Text 'grab the cell with the aryRecordId in it
-
Dim aryRecordId As Integer = Integer.Parse(x)
-
itemsToDelete.Add(aryRecordId)
-
End If
-
Next
-