GridView实现删除时弹出确认对话框
生活随笔
收集整理的這篇文章主要介紹了
GridView实现删除时弹出确认对话框
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
在RowDataBound事件中添加如下代碼:
?1?protected?void?GridView1_RowDataBound(object?sender,?GridViewRowEventArgs?e)?2?????{
?3?????????//如果是綁定數(shù)據(jù)行?
?4?????????if?(e.Row.RowType?==?DataControlRowType.DataRow)
?5?????????{
?6??????????????if?(e.Row.RowState?==?DataControlRowState.Normal?||?e.Row.RowState?==?DataControlRowState.Alternate)
?7?????????????{
?8?????????????????((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick",?"javascript:return?confirm('你確認(rèn)要刪除:\""?+?e.Row.Cells[1].Text?+?"\"嗎?')");
?9?????????????}
10?????????}?
11?????}
12?
?
轉(zhuǎn)載于:https://www.cnblogs.com/kevins/archive/2008/08/14/1267621.html
總結(jié)
以上是生活随笔為你收集整理的GridView实现删除时弹出确认对话框的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vs2005常用调试快捷键 (转载)
- 下一篇: ASP+COM 组件开发