Hi Calvin,
If you want to show up a javascript confirm before you delete every
record in the datagrid :
Put the javascript function given below in your aspx page
<script language='JavaScript'>
function ConfirmDelete()
{
if(confirm("Do you want to delete this record?")==true)
return true;
else
return false;
}
</script>
In your code behind :
Under the ItemDataBound event of your datagrid use this code :
If BtnDel is the ID of your LinkButton in the datagrid,
LinkButton lb;
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem){
lb = (LinkButton)e.Item.Cells[0].FindControl("BtnDel");
// 0 index is used for cell assuming BtnDel is the first item in the
datagrid.
lb.Attributes.Add("onclick", "return ConfirmDelete();")
}
Hope this helps,
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com
Calvin Lai said:
Hi all,
Does anyone know how I could add a confirm (client side) feature on those
Delete Linkbutton in DataGrid? Thanks,