![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/08/2007, 15:34
|
| | Fecha de Ingreso: junio-2004
Mensajes: 84
Antigüedad: 20 años, 7 meses Puntos: 0 | |
GridView 'GridView1' desencadenó el evento RowDeleting, que no estaba controlado. hola compañeros, por que este error??
"GridView 'GridView1' desencadenó el evento RowDeleting, que no estaba controlado."
estoy intentando eliminar cell de un gridview, y me sale ese mensaje de error... porfa ayuda.
mi codigo:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" DataKeyNames="Value">
<Columns>
<asp:BoundField DataField="Value" HeaderText="Valor" SortExpression="Value" />
<asp:BoundField DataField="Text" HeaderText="Texto" SortExpression="Text" />
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1"
CommandArgument='<%# Eval("Value") %>'
CommandName="Delete" runat="server">
Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1");
l.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete this record " +
DataBinder.Eval(e.Row.DataItem, "Value") + "')");
}
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
// get the categoryID of the clicked row
int categoryID = Convert.ToInt32(e.CommandArgument);
// Delete the record
DeleteRecordByID(categoryID);
// Implement this on your own :)
}
}
Gracias por su ayuda...! |