和DataGrid差不多
如果报这个错误“GridView”激发了未处理的事件“RowDeleting",该怎么处理??
解决 把CommandName="del" 不要写成'delete'
grid_RowCommand事件 就是 grid_ItemCommand
删除
<asp:LinkButton ID="LBtnDel" runat="server" CausesValidation="False" CommandName="del"
CommandArgument=<%# Bind("MessageID") %> Text="删除" OnClientClick="return confirm('确认要删除吗?');">
</asp:LinkButton>
protected void dlst_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "del")
{
int MsgID = Convert.ToInt32(e.CommandArgument.ToString());
...删除操作
}
}
如果报这个错误“GridView”激发了未处理的事件“RowDeleting",该怎么处理??
解决 把CommandName="del" 不要写成'delete'
grid_RowCommand事件 就是 grid_ItemCommand
删除
<asp:LinkButton ID="LBtnDel" runat="server" CausesValidation="False" CommandName="del"
CommandArgument=<%# Bind("MessageID") %> Text="删除" OnClientClick="return confirm('确认要删除吗?');">
</asp:LinkButton>
protected void dlst_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "del")
{
int MsgID = Convert.ToInt32(e.CommandArgument.ToString());
...删除操作
}
}