我不知道为什么,因为onrowdeleting
工作正常删除方法与更新方法在同一类中
<form id="formulario" runat="server" method="post">
<asp:GridView AllowPaging="true" id="inf_clientes" AutoGenerateColumns="false"
runat="server" GridLines="Both" BorderWidth="1"
onrowdeleting="Grid_DeleteCommand" onrowupdating="Grid_UpdateCommanda"
DataKeyNames="cliente_id,nombre,apellido,celular">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton CommandName="Delete" runat="server" ValidationGroup="validation" ImageUrl="borrar.jpg" ToolTip="Borrar" Height="20px" Width="20px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton CommanName="Update" ImageUrl="guardar.jpg" ValidationGroup="validation" runat="server" ToolTip="Guardar" Height="20px" Width="20px" />
</ItemTemplate>
</asp:TemplateField>
和后面的代码
protected void Grid_UpdateCommanda(object origen,GridViewUpdateEventArgs e)
{
con.Open();
EjecutarComando = new SqlCommand("UPDATE dclntes SET nombre='c' where cliente_id=4",con);
EjecutarComando.ExecuteNonQuery();
con.Dispose();
todos();
}
如果您需要更多,请告诉我