woodbutterfly
New Member
Hi, I have created a Column of Delete button <asp:ButtonColumn> in DataGrid. What I want is when a user clicks on the button, I want to pop up a Javascript confirmation box for deletion. Does anyone knows how to do this ?<BR><BR>Thanks<BR>MatthewAll you have to do is create a client-side javaScript function that will return a true or false value as the result of a confirmation box. <BR><BR>In your <asp:button...> declaration, you are going to add an onClick attribute. It should look like this:<BR><BR><asp:button onClick="return yourConfirmationFunction();" .../><BR><BR>When ASP .Net builds the html for this control on the server, it is going to append a "__doPostBack('controlname','eventargs')" function to the onClick event of the input button. So, if your confirmation function returns false, it will cancel the whole event bubble, true and it will go ahead with the submission and the server-side event. <BR><BR>I hope this helps.Hi Dan, thanks for your suggestion, however I am using <asp:buttoncolumn> which doesn't have onclick attribute. I am still searching for the solution.<BR><BR>Matthew