Greetings,
I am using datagrid control to insert, update, display and delete records.
I am have a lot of success implementing all of the above.
What I can't seem to get to work so far is confirming a delete before you actually delete.
For instance,
When I click the delete image, I would like to get an alert box that says, "are you sure you want to delete?"
Does anyone have any ideas what I am doing wrong?
From what I have read so far, you can accomplish this with an onItemDatabound event but I am using that for record viewing.
So, I tried using client side (javascript) validation which I think is actually better because it is faster but again, the record just gets deleted with no alert popping up.
Here are some code snips.
then the datagrid id:
then the delete button:
so, why is it not firing?
Thanks in advance
I am using datagrid control to insert, update, display and delete records.
I am have a lot of success implementing all of the above.
What I can't seem to get to work so far is confirming a delete before you actually delete.
For instance,
When I click the delete image, I would like to get an alert box that says, "are you sure you want to delete?"
Does anyone have any ideas what I am doing wrong?
From what I have read so far, you can accomplish this with an onItemDatabound event but I am using that for record viewing.
So, I tried using client side (javascript) validation which I think is actually better because it is faster but again, the record just gets deleted with no alert popping up.
Here are some code snips.
Code:
<script language="javascript">
<!--
function ondeleteclick()
{
return confirm("Are you sure you want to delete this?")
}
for(i=0;i<document.all.length;i++)
{
var x = document.all.item(i)
if(x!=null && x.name !=null && x.name.indexOf("MyDataGrid")==0)
{
if(x.value=="Delete")
x.onclick = ondeleteclick
continue;
}
}
//-->
</script>
then the datagrid id:
Code:
<asp:DataGrid id="MyDataGrid" runat="server"
then the delete button:
Code:
<asp:ButtonColumn Text="<img border=0 src=images/icon_delete.gif>" CommandName="Delete"></asp:ButtonColumn>
so, why is it not firing?
Thanks in advance