troubleshooting Question

Delete link in datagrid not working

Avatar of kdeutsch
kdeutschFlag for United States of America asked on
ASP.NETVisual Basic.NET
3 Comments1 Solution222 ViewsLast Modified:
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:linkbutton>
</ItemTemplate>
</asp:TemplateColumn>

THIS IS MY CODE BEHIND THAT GETS AT THE DATAGRID ROW.
Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)Handles 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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros