Datagrid Imagebutton Delete Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Erik Lautier

    Datagrid Imagebutton Delete Problem

    Hi, I'm running into a bit of a headache trying to use an imagebutton
    in my datagrid; if I use a linkbutton in a buttoncolumn, it all works
    perfectly, but the second I switch to an imagebutton in a
    templatecolumn, nothing happens...I don't get an error, it's just that
    the row is not deleted. Relevant code is below; would really
    appreciate a helping hand. Thanks.

    <asp:DataGrid ID="dgCart" AutoGenerateCol umns="false"
    ondeletecommand ="Delete_Ite m" runat="server">
    <columns>
    <asp:BoundColum n DataField="ID"/>
    <ASP:TEMPLATECO LUMN>
    <ITEMTEMPLATE >
    <ASP:IMAGEBUTTO N id="ImageDelete " Runat="server"
    AlternateText=" Delete" ImageUrl="butto ns/delete.gif"
    CommandName="De lete">
    </ASP:IMAGEBUTTON >
    </ITEMTEMPLATE>
    </ASP:TEMPLATECOL UMN>
    </columns>
    </asp:DataGrid>


    Sub Delete_Item(s As Object, e As DataGridCommand EventArgs)
    objDT = Session("Cart")
    objDT.Rows(e.It em.ItemIndex).D elete()
    Session("Cart") = objDT

    dgCart.DataSour ce = objDT
    dgCart.DataBind ()
    End Sub
Working...