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

ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
Pra4444

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Pra4444

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck