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
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.