i have one datalist having shopping cart table which retrieves values as per customer_id
aspx code.
<asp:DataList ID="DataList1" runat="server" DataKeyField="Customer_Product"
DataSourceID="SqlDataSource2" onupdatecommand="DataList1_UpdateCommand"
oneditcommand="DataList1_EditCommand1"
ondeletecommand="DataList1_DeleteCommand"
oncancelcommand="DataList1_CancelCommand1">
<HeaderTemplate>
<table border="solid 1px black">
<tr>
<th style="width: 250px">
</th>
<th style="width: 400px">
Item Description
</th>
<th style="width: 100px">
Price
</th>
<th style="width: 100px">
Qty
</th>
<th style="width: 100px">
Remove
</th>
<th style="width: 100px">
Total
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Product_Image") %>' Width="100px" Height="150px" />
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Item_Description") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Price") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Qty") %>
<br />
<asp:LinkButton ID="lnkEdit"
runat="server"
CommandName="edit">
Change
</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="LinkButton1"
runat="server"
CommandName="delete">
Delete
</asp:LinkButton>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Total") %> '></asp:Label></td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr>
<td>
<asp:Image ID="Image2" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Product_Image") %>' Width="100px" Height="150px" />
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Item_Description") %>
</td>
<td>
<asp:Label ID="price" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Price") %> '></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Qty") %>'>
</asp:TextBox>
<asp:LinkButton ID="lnkUpdate"
runat="server"
CommandName="Update">
Update
</asp:LinkButton>
<asp:LinkButton ID="lnkCancel"
runat="server"
CommandName="cancel">
Cancel
</asp:LinkButton>
</td>
<td></td>
</tr>
</EditItemTemplate>
<FooterTemplate>
</table>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</FooterTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:OnlineShopConnectionString2 %>"
SelectCommand="SELECT * FROM [Cart1] WHERE ([Customer_ID] = @Customer_ID)"
UpdateCommand="UPDATE [Cart1] SET [Qty] = @Qty,[Total]=@Total WHERE [Customer_Product] = @original_C_P"
DeleteCommand="delete from [Cart1] WHERE [Customer_Product] = @original_C_P" >
<SelectParameters>
<asp:QueryStringParameter Name="Customer_ID" QueryStringField="name"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_C_P" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Qty" Type="String" />
<asp:Parameter Name="Total" Type="String" />
<asp:Parameter Name="original_C_P" Type="String" />
</UpdateParameters></asp:SqlDataSource>
and using edit delete …