calling asp.net method from javascript

  • Thread starter Thread starter Scott M.
  • Start date Start date
S

Scott M.

All you can do from the client side is call a page to be loaded. But you
can call the page via a form submission or with a querystring attached so
that new page can look in the form collection or the querystring collection
and based on what is in there, it can fire a method. But, you can't call a
server-side method directly.
 
Hi,

try
{
var param;

param = <%= Reqest.QueryString("param") %>

if (param=="ON") {
//-- call a server-side code from client side if condition
client-side is met
<% MeAmServerSideVoid %>
}
}
catch
{
alert("Problemo Que Paso?");
}

Hope this answers your question,

Yama
 
Hi all,
Is it possible to call an asp.net method from Javascript. I want to
handle an event of a third party control in Javascript. The control passes
variable values in the parameters of the Javascript event handler. Now
depending on the value of this variables I want to call an ASP.Net method.
Thanks...
-Nikhil
 
the javascript can post to a hidden frame, and catch the results on the
postback. with netscape/mozilla you can make soap calls from javascript. IE
had soap support but current security settings now disable it (as it
required an active/x control). you can also use flash to make soap calls.

-- bruce (sqlwork.com)
 
Yama,
Thanks. This works great but the server side method gets called when the
page is loaded the first time. I want to call it explicitely from
Javascript.
 
Back
Top