In my conversion quest, I'm trying to get the ItemIndex. Normally, I would write:
<code> Sample code I took from another app
Sub
doInsert(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName = "Delete" Then
Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connString"))
Dim objDR As SqlDataReader
Dim Cmd As New SqlCommand("TAM_DEL_ITEMS", conn)
Cmd.CommandType = CommandType.StoredProcedure
Cmd.Parameters.Add(New SqlParameter("@ID", e.Item.ItemIndex))
Cmd.Parameters("@ID").Value = DataGrid1.DataKeys(CType(e.Item.ItemIndex, Integer))
conn.Open()
Cmd.ExecuteNonQuery()
DataGrid1.EditItemIndex = -1
conn.Close()
End If
BindData()
End Sub
</code>
Here's what I've tried . . .
<code>
Sub
doInsertEmail(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName = "DeleteEmail" Then
Dim objFiles As New PartyPlannerController
Dim EmailID As Integer = CType(DataGrid1.DataKeys(e.Item.ItemIndex), Integer
Dim objFile As PartyPlannerInfo = objFiles.DeleteEmails(EmailID))<------------------------- Get item does not produce value error.
End If
End Sub
</code>
I've tried a few different ways to do this and just not licking it. Plus, I'm not seeing anything in the posts. Is this too simple? Is everyone aceing this? Can anyone point out what I'm doing wrong?
Any assistance would be appreciated!