Re: ASP.NET Causing execution of JavaScript on the client side

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Shailesh Ratadia (shaileshdr_at_hotmail.com)
Date: 05/19/04


Date: Wed, 19 May 2004 16:36:06 -0700

Hi Alex,

I am not sure what is the most elegant way of doing this. However, one of
the ways I can think of doing this is:
When you meet the condition where you need to execute the client side
script, you can redirect to your page with some parameter in the url. Then,
in your client side script, see if that parameter exists in the url
(document.url), you can execute your script.

Hope that helps.

-Shailesh

"Alex Maghen" <alex@maghen.com> wrote in message
news:45720015-43A5-46C4-B6B2-A75272B23F90@microsoft.com...
> I have an ASPX with a code-behind page. The ASPX has a client-side script
block with a JavaScript function defined in it. I need to be able to write
.CS code in my code-behind file that will, under certain circumstances,
cause the client-side JavaScript function to execute when the page loads.
>
> I can think of some bizarre ways of doing this such as somehow editing the
<BODY> tag in ASP.NET to inser the OnLoad Attribute when I do want the
JavaScript function to execute (though I don't know quite how to do this -
do I have to set the BODY tag as runat="server" and then how to I access
that "object" from the code-behind?).
>
> Or is there a more elegant way that ASP.NET has to support server-side
"control" of client-side scripting.
>
> Help?
>
> Alex



Relevant Pages

  • Re: is it possible to call vbs file with js?
    ... Server side code will *never* execute in the browser. ... shared between server and client (e.g. parsers, validators, HTML forms ... But they won't share the same script block. ...
    (comp.lang.javascript)
  • Re: Executing client *and* server side script with one call
    ... that executes javascript that checks for your javascript function and if it ... > Here is the client script I want to execute. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: [PHP] Include Problem
    ... what I got from my client, he calls this behind the scenes to avoid ... Windows with my current script, (the one to execute things from), ... the remote script, passing values either via GET or POST. ...
    (php.general)
  • Re: is it possible to call vbs file with js?
    ... side script to execute in firefox" and the answer is quite simple. ... Server side code will *never* execute in the browser. ... client side script "prints" the HTML into the document object. ...
    (comp.lang.javascript)
  • Re: Install printers to groups of users or computers by using Group Policy
    ... In the SBS 2003 environment, the client printer is installed by the SBS ... The script do not depend on group policy, ...
    (microsoft.public.windows.server.sbs)