Rather than a button column try this;

<asp:TemplateColumn>
<ItemTemplate>
<input type="button" onclick="ConfirmDelete('<%#
DataBinder.Eval(Container.DataItem, "ID")%>');" value="Delete">
</ItemTemplate>
</asp:TemplateColumn>

"ID" is the field in the data the grid is bound to that identifies your
record.

Then at the bottom of the page something like;

<script language="vbscript">
sub ConfirmDelete(i)
        if MsgBox ("Do you wish to delete record " & i & "?", 4, "Delete
record") = 6 then
                location.href = "Delete.aspx?ID=" & i
        end if
end sub
</script>

-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Mills, Andy R.
(Regency)
Sent: 10 August 2005 3:48
To: '[email protected]'
Subject: [ASP] Popup Confirmation on .Net


Hello Guys:
 
I am using a DataGrid in an ASP.Net (C#) application that has the usual:
<asp:EditCommandColumn....>.  However:  I am also using <asp:ButtonColumn
CommandName="Delete!"....>
 
What I would like is:  when the user clicks the delete link:  a pop up
window to appear for confirmation.  If the user clicks yes, continue with
the delete.  If they click cancel:  then do not delete.  
 
I am familiar with how to do this in ASP Classic (JavaScript) and Windows
Forms (MessageBox.Show()).  However:  I am not sure how to do this in
ASP.Net using a datagrid with a ButtonColumn.
 
Any help, tips, pointers etc. would be greatly appreciated.
 
Thanks
 
Andy Mills
Programmer
Regency Thermographers
717-765-3572
 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
http://www.regencythermo.com <http://www.regencythermo.com/> 
 
 
 


[Non-text portions of this message have been removed]




---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links



 


The contents of this email and any attachments are sent for the personal 
attention
of the addressee(s) only and may be confidential.  If you are not the intended
addressee, any use, disclosure or copying of this email and any attachments is
unauthorised - please notify the sender by return and delete the message.  Any
representations or commitments expressed in this email are subject to contract. 
 
ntl Group Limited



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h2mh2lq/M=362335.6886445.7839731.1510227/D=groups/S=1705115381:TM/Y=YAHOO/EXP=1123696203/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to