Link to home
Start Free TrialLog in
Avatar of TrialUser
TrialUserFlag for Afghanistan

asked on

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 vb.net code. Please let me know how I can do it.
<script type="text/javascript">
    function Print() {
        window.print();
        document.getElementById('tblDash').style.display = 'none';        
        window.print();        
    }
    </script>
Avatar of Gary
Gary
Flag of Ireland image

vb.net is server side
javascript is client side

you cannot call one from the other

Explain more what you are trying to achieve
Avatar of TrialUser

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

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