title: Datalist Itemcommand event is not working
body: <p>I am trying to work on itemcommand event of datalist. I want to work with the button that is bind in datalist. But when i add a breakpoint on the itemcommand event the event doesnot run.Please tell me why it is not working here is the datalist source and my code</p>
  
  <pre><code>&lt;asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" 
              onitemcommand="DataList1_ItemCommand1" &gt;
          &lt;ItemTemplate&gt;
           &lt;ul&gt;
          &lt;li&gt;
      &lt;a href="#"&gt;&lt;asp:Image ID="Image1" runat="server" ImageUrl='&lt;%#Eval("pictureurl") %&gt;' Width="170px" Height="104px" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;asp:Label ID="Label1" runat="server" Text='&lt;%#Eval("fullname") %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt;
                  &lt;asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/Icons/accept1.png" CommandName="Accept"   /&gt;&amp;nbsp;&lt;asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/Icons/decline.png"   /&gt;&amp;nbsp;
  
          &lt;/li&gt;
          &lt;/ul&gt;
          &lt;/ItemTemplate&gt;
          &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>  if (e.CommandName == "Accept")
          {
              string id = DataList1.DataKeys[e.Item.ItemIndex].ToString() ;
  
              SqlCommand CmdAcceptRequest = new SqlCommand("Update FriendRequest set requeststatus='Accept' where RequestFrom='" + id + "'", con);
              CmdAcceptRequest.CommandType = CommandType.Text;
              CmdAcceptRequest.ExecuteNonQuery();
              CmdAcceptRequest.Dispose();
  
  
  
           }
  </code></pre>
  
  <p>This code is not working for me. Item command event is not working Please experts tell me where i am wrong</p>