Calling a sever side code behind sub routine from client side java script


Hi

is it possible to call a server side sub routine from client side javascript
what I what to do is call a form based email routine from the client, I am hoping that by doing it this way I can disable the button used to call the routine imeadiatly so it's only possible to click it 1 time to prevent the same email being send multiple times, and in addtion start a client routine to indicate the email is underway with some graphic of some sort so the use knows that something is happening, all this is because if the attacment is quite large it takes a little while for the procees to complete making it appear that nothing much is happening
so to sum up can I call Call subSendEmail() in a VB.net code behind form for javascript on the client
If I can could some1 give me a code sample please
Thanks

0
Spire128
1/12/2005 9:46:39 PM
📁 asp.net.client-side
📃 24353 articles.
⭐ 2 followers.

💬 1 Replies
👁️‍🗨️ 2347 Views


You can't call from server-side to client-side and vice-versa.  But, you can drop client-side code and trigger server-side events to provide similar functionality.

To keep the click from being firable twice and show a progress indicator add a client-side handler:
onclick="this.disabled=true; window.open('<Animated gif popup URL>','ProgressWindow');"
Keep the same server-side handler to do the email and when you render the page after the postback do:
Page.RegisterStartupScriptBlock("ProgressClose","<script language='javascript'>var winRef=window.open('','ProgressWindow'); winRef.close();</script>");
0
stiletto
1/13/2005 12:31:24 PM
Reply: