怎样给Gridview控件的删除时添加提示?
//在 RowDataBound中写入以下代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType ==
DataControlRowType.DataRow)
{
if
(e.Row.RowState == DataControlRowState.Normal || e.Row.RowState ==
DataControlRowState.Alternate)
{
//Cells获取删除按钮所在的列 要更具删除按钮所在的列来定,由于我的删除是采用图片
//故强制转换成ImageButton,
((ImageButton)e.Row.Cells[1].Controls[0]).Attributes.Add("onclick","return
confirm('确定要删除!')");
}
}
}