Link to home
Start Free TrialLog in
Avatar of BRhone
BRhone

asked on

Calling Sub in Code Behind after confirmation in GridView

Sorry if I sound confusing, I'm still learning .NET..

I am using a VB code behind page in a ASP.NET form.  I have a GridView that is working fine and a Delete Command Button in a TemplateField. The delete button is using OnClientClick to execute a Confirm before running the delete command.

My question is, how can I call a Sub in my code behind page after the confirmation?

Here's my code:

<asp:TemplateField HeaderText="Modify/Delete" HeaderStyle-Width="80px">
                    <ItemTemplate>
                        <asp:Button ID="editButton" runat="server" CommandName="Edit" Text="Modify" Font-Size="X-Small" Width="45px" />
                        <asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" 
                            Width="45px" OnClientClick="return Confirm('Are you sure you want to delete this photo?');" Font-Size="X-Small" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Button ID="updateButton" runat="server" CommandName="Update" Text="Update" Font-Size="X-Small" Width="45px" />
                        <asp:Button ID="cancelButton" runat="server" CommandName="Cancel" Text="Cancel" Width="45px" Font-Size="X-Small" />
                    </EditItemTemplate>
                    <HeaderStyle Width="80px"></HeaderStyle>
                </asp:TemplateField>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pra4444
Pra4444
Flag of United States of America 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