-1

Possible Duplicate:
calling ASP function from javascript

okay running this code :

     <script type="text/javascript">
    function hello() { 
        alert("hello world from javascript ")
    }
 </script>
  </head>
 <body>
<form id="form1" runat="server">
<div>
    <asp:Button ID="buttonme" runat="server" OnClientClick="javascript:hello()" Text="click" />
</div>

CODE BEHIND :

  Protected Sub buttonme_Click(ByVal sender 
As Object, ByVal e As EventArgs) Handles buttonme.Click
    MsgBox("hello world from vb.net ")
End Sub

will execute the javascript message before the vb.net MsgBox ? is there is a way to make this flipped to execute the javascript function second THANKS

2
  • 3
    How is this different from your last question? stackoverflow.com/questions/11039545/… Commented Jun 14, 2012 at 19:30
  • i think there is no way to do this with out ajax Commented Jun 14, 2012 at 19:32

1 Answer 1

1

The short answer is no. The VB code is server side. The javascript code is on the client side. There are ways to execute server side code from javascript (e.g. Ajax).

Also, you don't want to call MessageBox.Show on the web server as there should be no UI there and it will block execution.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.