piya p

piya p

  • NA
  • 84
  • 48.1k

How to delete items in datalist using checkbox on button cli

Apr 28 2014 6:26 AM
am using following code in my application.

<asp:Button ID="dltalbums" runat="server" OnClick="dltalbums_Click" Text="Delete Selected Albums" />

<asp:DataList ID="datalist1" RepeatDirection="Horizontal" DataKeyNames="value1" RepeatColumns="2" runat="server" CellSpacing="5" >
<ItemTemplate >
<asp:CheckBox ID="chk" runat="server" />
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("value1") %>' , Height="150" Width="150" onclick='ImageButton1_Click' />
<asp:HiddenField ID="albumidhdn" Value="1" runat="server" />
</ItemTemplate>
</asp:DataList>

What I want to do is when user click on delete button albums should get deleted from page and database

What is the best way to do this?