Click here to Skip to main content
16,020,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
befor user deletes the record from gridview i want to display a confirm t the user how to use the return value from the confirm box...
Posted

Did you try searching google[^]?
It has ample amount of examples addressing your requirement, top links being:
ASP.NET GridView delete confirmation using asp:CommandField[^]
confirm-delete-for-gridview.html[^]
adding-a-confirm-javascript-popup-to-net-gridview[^]
 
Share this answer
 
Just add onClientClick attribute to the control if inside TemplateField.

How to add a “confirm delete” option in ASP.Net Gridview?[^].

XML
<asp:TemplateField ShowHeader="False">
    <ItemTemplate>
         <asp:ImageButton ID="DeleteButton" 
                          runat="server" 
                          ImageUrl="~/site/img/icons/cross.png" 
                          CommandName="Delete" 
                          OnClientClick="return confirm('Are you sure you want to delete this event?');" 
                          AlternateText="Delete" />
    </ItemTemplate>
</asp:TemplateField>


And also check DISPLAY CONFIRMATION MESSAGE ON GRIDVIEW DELETING[^] for detailed and clear implementation techniques using "Option A: Using the ShowDeleteButton CommandField" and "Option B: Using TemplateField with LinkButton".

Thanks...
 
Share this answer
 
v2
Comments
[no name] 28-Jan-13 3:14am    
+5
Thanks @Sisir.
[no name] 28-Jan-13 3:25am    
yw... :)

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