首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

为 GridView 添加了 <asp:CommandField ShowDeleteButton="True" HeaderTex

2012-01-15 
为 GridView 添加了 asp:CommandField ShowDeleteButtonTrueHeaderText删除 / ,可是如何实现删除

为 GridView 添加了 <asp:CommandField ShowDeleteButton="True" HeaderText="删除" /> ,可是如何实现删除确认呢?


我为   GridView1   加了:

<asp:GridView   ID= "GridView1 "   runat= "server "   OnRowDeleting= "GridView1_RowDeleting ">

<asp:CommandField   ShowDeleteButton= "True "     HeaderText= "删除   />

然后在后台   .CS   中的:

  protected   void   GridView1_RowDeleting(object   sender,   GridViewDeleteEventArgs   e)
{
    //这是删除数据的事件

}

现在的问题是如何能实现删除确认,然后,执行到   GridView1_RowDeleting   删除事件呢?


[解决办法]
<asp:LinkButton> 中加入:OnClientClick= "return confirm( '确认要删除吗? '); "
[解决办法]
把这个删除转换成模板列。然后给这个按键添加对话框事件。。

热点排行