Click here to Skip to main content
Sign Up to vote bad
good
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)
   {
       try
       {
           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">
                  <ItemTemplate>
                  <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>
                      </div>
 
                  </ItemTemplate>
 

                  </asp:DataList>
 

I cant remove particular image when i click the remove button..
Posted 9-Jan-13 23:12pm
Edited 9-Jan-13 23:27pm

Comments
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..
puskar gupta - 10-Jan-13 5:37am
i am not getting what r u wanna to try!!
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

Hi,
 
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.
 
Thanks
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 373
1 OriginalGriff 326
2 Prasad_Kulkarni 314
3 Ron Beyer 286
4 Prasad Khandekar 225
0 Sergey Alexandrovich Kryukov 7,061
1 Prasad_Kulkarni 4,046
2 OriginalGriff 3,749
3 _Amy 3,450
4 CPallini 3,114


Advertise | Privacy | Mobile
Web01 | 2.6.130619.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid