Calling ASP.NET Function from JavaScript

Is it possible to call a function from Javascript?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not direcrtly. You can use AJAX techniques to call back into server into particular function.
I think another hack would be to have a hidden button and call in javascript which would call your function... let me know if you want the code to invoke a button click in javascript.
Mike_StevensAuthor Commented:
I would appreciate some sample code
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

before I try anything, what exactly are you trying to do.. what is the scenario when you want to invoke this function on client side?
Mike_StevensAuthor Commented:
I am using javascript to rotate banner ads in the masterpage of a project i am working on.  I am trying to write information on at ad that has just been clicked by the user in an effort to track how many times each ad has been clicked.
can you have something like this on the click event of your ad image?  you should have a hidden asp:button with click event defined in code behind.. i haven't tried it, but you can give it a shot.

<a href="testURL"    onclick="document.getElementById('hiddenButton').click(); return false;"> <asp:Image id="AdImage"/> </a>

if you can't do this, you can still write to a cookie incrementing the count everytime the user clicks the ad and read from it on page_load and update where you want to, of course you have to implement the logic so that you dont duplicate the count and keep adding it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

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.