R8VI
asked on
how to call c# method in javascript
Hi,
I have the following method in c#
and the following code in javascript
I have the following method in c#
public void logout()
{
}
and the following code in javascript
<script type="text/javascript">
window.onunload = function unloadEvent() {
<%logout()%> ;
}
</script>
which gets called like so
<body onbeforeunload="unloadEvent()">
But i get the following error
CS1002: ; expected
Line 8: <script type="text/javascript">
Line 9: window.onunload = function unloadEvent() {
Line 10: <%logout()%> ;
Line 11:
Line 12: }
please help
Thanks,
R8VI
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<%logout()%> ;
to
<%logout();%>