这是aspx文件里gridview的帮定删除列. 已经设置好了datakeyname 为 id
<asp:TemplateField HeaderText="删除">
    <ItemTemplate>
      <asp:ImageButton CommandName="delete" ID="imgdel" Runat="server"ImageUrl="../images/delete.gif" CssClass="input_hand" AlternateText="删除">
       </asp:ImageButton>
   </ItemTemplate>
</asp:TemplateField>这是删除事件代码.但是这是有问题的事件代码,大家帮我看看.
 protected void Fw_delete(object sender, GridViewDeletedEventArgs e)
    {
     string autoid = this.GridView1.DataKeys[e.Item.ItemIndex];     string Strcon = System.Configuration.ConfigurationSettings.AppSettings["connection"];
        SqlConnection sqlconn = new SqlConnection(Strcon);
       sqlconn.Open();
        SqlCommand mySqlCommand = sqlconn.CreateCommand();
        mySqlCommand.CommandText = "execute usp_com_ygtfmng_delete @autoid";
       mySqlCommand.Parameters.Add("@autoid", SqlDbType.NVarChar, 50).Value = autoid;
       mySqlCommand.ExecuteNonQuery();
        Common.Message(this, "数据删除成功");
    }