TrialUser
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('t blDash').s tyle.displ ay = 'none';
window.print();
}
</script>
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('t
window.print();
}
</script>
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sample on code project
http://www.codeproject.com/Articles/180355/Calling-a-code-behind-function-from-JavaScript
http://www.codeproject.com/Articles/180355/Calling-a-code-behind-function-from-JavaScript
You can also have a button in page and call its click method using javascript.
Hi,
You can achieve it using Client Callbacks!
http://msdn.microsoft.com/en-us/library/ms178208%28v=vs.100%29.aspx#Y1254
http://msdn.microsoft.com/en-us/library/ms178209%28v=vs.100%29
You can also do that using PageMethods!
http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX
Hope it helps u...
You can achieve it using Client Callbacks!
http://msdn.microsoft.com/en-us/library/ms178208%28v=vs.100%29.aspx#Y1254
http://msdn.microsoft.com/en-us/library/ms178209%28v=vs.100%29
You can also do that using PageMethods!
http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX
Hope it helps u...
javascript is client side
you cannot call one from the other
Explain more what you are trying to achieve