onrowupdating事件不起作用

时间:2013-02-18 14:24:11

标签: c# asp.net

我不知道为什么因为onrowdeleting工作正常 delete方法与更新方法

在同一个类中
<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();
    }

如果您需要更多,请告诉我

1 个答案:

答案 0 :(得分:0)

我被告知回答自己,所以我这样做: 错误是写CommanName而不是CommandName。我不知道它是否会对某人有所帮助,但这就是问题所在。

相关问题