Link to home
Start Free TrialLog in
Avatar of Stanton_Roux
Stanton_RouxFlag for South Africa

asked on

Confirmation dialog box then call funtion

Hi There

I have a grid view that contains a Item Template with an ASP Button in.
I would like to have a confirmation dialogue box confirming the delete then call the Function I have written for the delete functionality.

Thanks
Stanton
<asp:GridView ID="gvAllergies" CssClass="grid" runat="server" AutoGenerateColumns="False"
                            CellPadding="4" Width="100%" DataKeyNames="ID" ForeColor="#333333" GridLines="Horizontal"
                            AlternatingRowStyle-BackColor="WhiteSmoke"
                            OnRowCreated="gvAllergies_RowCreated">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <Columns>
                            <asp:TemplateField HeaderText="View">
                                <ItemTemplate>
                                    <asp:ImageButton ID="selectAllergy" runat="server" ImageUrl="~/images/Editsml.gif"
                                        OnClick="selectAllergy_Click" CommandArgument='<%# Bind("Id") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                                <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" ItemStyle-CssClass="gridrow" />
                                <asp:BoundField DataField="Onset" HeaderText="Onset" SortExpression="Onset" ItemStyle-CssClass="gridrow" />
                                <asp:BoundField DataField="OnCard" HeaderText="On Card" SortExpression="OnCard" ItemStyle-CssClass="gridrow" />
                                <asp:BoundField DataField="OnReport" HeaderText="On Report" SortExpression="OnReport" ItemStyle-CssClass="gridrow" />
                                <asp:BoundField DataField="Confidential" HeaderText="Confidential" SortExpression="Confidential" ItemStyle-CssClass="gridrow" />
                                <asp:TemplateField HeaderText="Delete">
                                 <ItemTemplate>
                                    <asp:ImageButton ID="DeleteAllergy" runat="server" ImageUrl="~/images/Deletesml.gif"
                                        OnClick="DeleteAllergy_Click" CommandArgument='<%# Bind("ID") %>' />
//Onclick Here I would first like a confirmation dialogue the call the delete function.
 
                                </ItemTemplate>
                            </asp:TemplateField>
                            </Columns>
                            <HeaderStyle CssClass="gridhead" />
                            <RowStyle CssClass="gridrow" />
                            <EmptyDataTemplate>
                                <span class="gridrow">There are no current Allergies. Click the button above to add a new Allergy.</span>
                            </EmptyDataTemplate>
                        </asp:GridView>

Open in new window

Avatar of tillgeffken
tillgeffken

ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial