You can use javascript for confirmation. Just convert your delete button to a template fieldin the grid. Replace your data grid code with
and put this javascript function in the head element of your page after the title.Code:<asp:DataGrid id="DataGrid1" OnItemCommand="ItemCommand" style="Z-INDEX: 101; LEFT: 175px; TOP: 105px" runat="server" CssClass="tx-tbl-Gr-lml" Width="474px" AllowPaging="true" > <Columns> <asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Edit"> </asp:ButtonColumn> <asp:TemplateColumn> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return confirmdelete();" CausesValidation="false" CommandName="Delete" Text="Delete"></asp:LinkButton> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid>
Now if you click on the delete button you will be asked for confirmation. And the page will post back only if you click on the ok button.Code:<script language="javascript" type="text/javascript"> function confirmdelete() { var ok = confirm("Should I delete"); return ok; } </script>
Warm Regards,




Reply With Quote