Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 962
  • Last Modified:

CSS Button onclick fire a code behind method

I created a CSS Button with rollover effects.
Here is the Source code for the buton:
<div id="rollovers">  
    <a  href="#"  onclick="GetES()" >
    </a>
 </div>
What I would like to happen is that when the user clicks on the CSS Button the "GetES" function in the Code Behind would fire.
Thanks
Matt
0
mutlyp
Asked:
mutlyp
  • 2
1 Solution
 
Ali KayahanFull Stack DeveloperCommented:
<div id="rollovers">  
    <a  href="#"  onclick="GetES()" >click
    </a>
 </div>
should already work ..
0
 
mutlypAuthor Commented:
Maybe I did not explain it correctly.
This code:
<div id="rollovers">  
    <a  href="#"  onclick="GetES()" >click
    </a>
 </div>
is in my default.aspx page in the source code.
The GetES function:
Public Sub GetES()

End Sub

is in my default.aspx.vb page in the code behind.

When I put a break point on the Public Sub GetES() and then click on the CSS Button it does NOT hit GetES().
Hope this clears it up some.
Matt
0
 
mutlypAuthor Commented:
Hey Guys
Came up with the solution. All you do is use this code

<a  href="#"  onclick="javascript:__doPostBack('Button1', '');" />
then put a button on your page but make all the attributes for the button Transparent. Then when the user clicks on the hyuperlink the button will fire on the code behind.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now