troubleshooting Question

Calling Sub in Code Behind after confirmation in GridView

Avatar of BRhone
BRhone asked on
ASP.NETVisual Basic.NET
1 Comment1 Solution741 ViewsLast Modified:
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>
ASKER CERTIFIED SOLUTION
Pra4444

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros