Calling a method in code behind from javascript

HOw can I call a method that I have in code behind .

I have the following javascript in my page. at the end of the function I want to execute some code. Please let me know how I can do it.
<script type="text/javascript">
    function Print() {
        document.getElementById('tblDash').style.display = 'none';        
Who is Participating?
Then in your javascript all you should need to do after calling the print dialog is
window.location = ""

and in that page clear the sessions and continue on.

But I think your logic maybe amiss, surely there is no reason to not just clear the session once they land on the print page i.e. in your code behind clear those sessions since they are not needed any more once the print page has been sent. And the print page should open in a new tab so they retain the original url
GaryCommented: is server side
javascript is client side

you cannot call one from the other

Explain more what you are trying to achieve
TrialUserAuthor Commented:
MAy be something like trigger an event , like a linkbutton click or soemthing?
And have the code behind the link button click.

What I am trying to do is :
1) I need a print a receipt when a transaction is complete . I load the html for the page on page_preload.
2) then javascript is executed on form loader
3) after receipt is printed, I wa nt to clear some session objects and redirect to anothe page

Please help thanks
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

You can also have a button in page and call its click method using javascript.
Roopesh ReddyIT AnalystCommented:
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.