kdeutsch
asked on
Delete link in datagrid not working
I am trying to add a delete link button to a daragrid in asp.net 1.1. I have the link button in and code from MSDN that looks like it gets intot he correct position of datagrid when I do a response.write index it looks at the correct rows. But my delete functionality does not work. How can i delete that row from the table where the StrRecordNumber is equal to itself.
THIS IS MY LINK BUTTON IN DATAGRID
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:linkbutton id="lnkDelete" runat="server" text="Delete" commandname="Delete"></asp :linkbutto n>
</ItemTemplate>
</asp:TemplateColumn>
THIS IS MY CODE BEHIND THAT GETS AT THE DATAGRID ROW.
Private Sub DataGrid1_DeleteCommand(By Val source As Object, ByVal e As System.Web.UI.WebControls. DataGridCo mmandEvent Args)Handl es myDataGrid.DeleteCommand
Dim index As Integer
index = e.Item.ItemIndex
insertUpdateDelete("delete table1 where strRecordNumber = '" & ID & "'")
Insertupdate delete calls out my connectionstring from my common.vb file.
myDataGrid.DataBind()
End Sub
THIS IS MY LINK BUTTON IN DATAGRID
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:linkbutton id="lnkDelete" runat="server" text="Delete" commandname="Delete"></asp
</ItemTemplate>
</asp:TemplateColumn>
THIS IS MY CODE BEHIND THAT GETS AT THE DATAGRID ROW.
Private Sub DataGrid1_DeleteCommand(By
Dim index As Integer
index = e.Item.ItemIndex
insertUpdateDelete("delete
Insertupdate delete calls out my connectionstring from my common.vb file.
myDataGrid.DataBind()
End Sub
Is the record deleted in database? Or just the DataGrid does not refresh to reflect the deletion?
ASKER
It is not deleted in the database, I cannot figure out how to match the index number to the strRecordNumber so it deletes the records.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.