Click here to Skip to main content
12,892,796 members (61,126 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
Hi can anyone help me.. Why this itemcommand doesn't works properly, when i click the remove button??

protected void list_ItemCommand1(object source, DataListCommandEventArgs e)
           if (e.CommandName == "Remove")
               HiddenField id1 = (HiddenField)list.Items[e.Item.ItemIndex].FindControl("hf1");
               if (dbo.deleterecords("image", "id='" + id1.Value + "'") == true)
                   lbldel.Text = "Image Deleted";
       catch (Exception ex)
           Exception E = ex;

<asp:DataList ID="list" runat="server" RepeatColumns="5" ShowFooter="true" ShowHeader="true" Width="98%" OnItemCommand="list_ItemCommand1">
                  <div align="center">
                  <asp:Image ID="img" runat="server" BorderColor="white" BorderWidth="2" Height="100"
                      ImageUrl='<%# "~/Image.aspx?id="+Eval("id") %>' Width="100px"/>
                      <asp:HiddenField ID="hf1" runat="server" Value='<%# Eval("id") %>' />
                      <br />
                      <asp:LinkButton ID="linkremove" runat="server" CommandName="Remove" Text="Remove"></asp:LinkButton>


I cant remove particular image when i click the remove button..
Posted 9-Jan-13 23:12pm
Updated 9-Jan-13 23:27pm
Sanjeev Alamuri 10-Jan-13 5:17am
Whats the error you are facing?
Sasikala Gurusamy 10-Jan-13 5:27am
I cant remove particular image when i click the remove button..
Sasikala Gurusamy 10-Jan-13 5:40am
Here am displaying uploaded images in datalist..this admin part. here i want to delete particular image means , am going to click remove button.. but this is not working..

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Please debug first in Page_Load event and by pressing F10 go ahead and check if there is any error which can be the cause of your problem.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100