本文實(shí)例展示了asp.net實(shí)現(xiàn)刪除DataGrid的記錄時(shí)彈出提示信息的方法,在進(jìn)行項(xiàng)目開發(fā)的時(shí)候非常實(shí)用,具體步驟如下:
1.在DataGrid中加一超鏈接按鈕列,文本設(shè)為"刪除",在aspx頁面中加上如下代碼:
script language="JavaScript">
function delete_confirm(e){
if(event.srcElement.outerText=="刪除"||event.srcElement.name=="btnDictDel")
event.returnValue=confirm("該操作將永久刪除,確定刪除?");
}
document.onclick=delete_confirm;
/script>
2.在DataGrid中加一超鏈接按鈕列,ID設(shè)為"del",綁定數(shù)據(jù)后即可。代碼如下:
for(int i=0;i myCount;i++)
{
((ImageButton)dataGrid.Items[i].FindControl("del")).Attributes.Add("onclick","return confirm('該操作將永久刪除,確定刪除?");')");
}
您可能感興趣的文章:- asp.net DataGrid控件中彈出詳細(xì)信息窗口
- asp.net中GridView和DataGrid相同列合并實(shí)現(xiàn)代碼
- ASP.NET MVC中EasyUI的datagrid跨域調(diào)用實(shí)現(xiàn)代碼
- ASP.NET MVC使用EasyUI的datagrid多選提交保存教程
- asp.net DataGrid 中文字符排序的實(shí)現(xiàn)代碼
- asp.net DataGridView導(dǎo)出到Excel的三個(gè)方法[親測]
- 在asp.net中實(shí)現(xiàn)datagrid checkbox 全選的方法
- 決定何時(shí)使用 DataGrid、DataList 或 Repeater(ASP.NET 技術(shù)文章)
- asp.Net JS取母板頁控件值的簡單方法
- Asp.net清空控件值的方法(可自定義控件類型)
- asp.net 保存、修改沒有 runat=server控件的控件值的一個(gè)解決方案
- ASP.NET中訪問DataGrid中所有控件值的方法