Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SIR,
i have taken checkbox column in gridview & button button outside the gridview then i want to delete selected checkbox record using delete button. i want confirmation message before deletion like "are u sure to delete selected items"
i trying it by using javascript but i fail to do. so please tell me solution if any.
thanks and regards.
dnyaneshwar
Posted
Comments
walterhevedeich 22-Jul-11 2:19am    
You said you tried. if so, you may post your code here so others might help you troubleshoot what the problem is. Click on Improve Question and edit your question, and include the code.

Try this.
<asp:button id="btnDel" runat="server" onclientclick="javascript:return confirm('Are you sure you want to delete this user?')" xmlns:asp="#unknown" />
 
Share this answer
 
Comments
walterhevedeich 22-Jul-11 2:55am    
Correct.
XML
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
               ConfirmText="Are you sure that you are leaving the office ?" TargetControlID="Button1<code></code>"  ConfirmOnFormSubmit="false"
Enabled="true">
               </cc1:ConfirmButtonExtender>



use ajax control and set TargetControlID = button id of button outside gridview
 
Share this answer
 
 
Share this answer
 
Hi,
This is the solution:


XML
<script language ="javascript" type ="text/javascript">
    function test() {
        if (confirm('Are u sure ?'))
            return true;
        else
            return false;

    }
</script>



button code:

<asp:Button ID="btnDelete" runat="server" OnClientClick="return test();" Text="Save" onclick="btnDelete_Click" />


Here writing of return in front of OnClientClick="return test() will decide to go for delete event or not if it returns true it will perfom delete function else it will discard delete function
 
Share this answer
 
v3
use the onclient method,it should be something like this :

onclientclick="javascript:return confirm('your message ?')
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900