Click hyperlink programmatically

I have an <a> tag in an aspx page with onclick javascript attached to it.  I also have a button with a subroutine in the code behind doing some stuff.  I want the user to click the button, do the sub, then have it click that <a> automatically to do the javascript.  How can I do this?  I've tried casting the <a> as an mshtml.IHTMLElement, then using the .click action, but that didn't work.

Basically I found a javascript (GB_Show) called Greybox which pops a great preview window that I want the Account Detail page to show in.   Just clicking the link works great, but I need to do a database update and set a session variable, thus the need for a sub in the code behind.
code behind for the button:
  Public Sub btnRedirect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRedirect.Click
        Dim f As mshtml.IHTMLElement = DirectCast(Me.TestA, mshtml.IHTMLElement)
    End Sub
code for the front end of the button and the anchor
 <asp:Button  ID="btnRedirect" runat="server" Text="Acknowledge and go to Account Detail" Width="300" />
                          <a id="TestA" runat="server" onclick="return GB_show('Account detail', 'http://webserver/account_detail.aspx', 600, 800)" >
                                                            Email - outbound</a>

Open in new window

Who is Participating?
flagshipcreditAuthor Commented:
I figured it out...I removed the <a> completely, and used ScriptManager.RegisterStartupScript on the button.

flagshipcreditAuthor Commented:
No dice with the onclick.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.