Link to home
Start Free TrialLog in
Avatar of flagshipcredit
flagshipcredit

asked on

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)
        f.click()
    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

Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Avatar of flagshipcredit
flagshipcredit

ASKER

No dice with the onclick.
ASKER CERTIFIED SOLUTION
Avatar of flagshipcredit
flagshipcredit

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