Calling client side script from server side event

Calling client side script from server side event

Post by Mark Evere » Fri, 07 Mar 2003 02:53:04



Hi all,

I need to run a client side script which is generated in a server side
function. The script opens a window.

I wasn't sure of the correct (best) way to execute the script. In the
end the best solution seems to be to dynamically add a label control
to the page with its text set to my open window script.

This works but the window is displayed and then the window with the
main web page is loaded on top of it.

I could use a timer to make the window (hopefully) have it's focus set
after this point but it all seems a bit kludgy.

Any suggestions?

Mark

 
 
 

Calling client side script from server side event

Post by Kevin Spence » Fri, 07 Mar 2003 22:14:58


Page.RegisterStartupScript("Key", scriptString)

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Neither a follower nor a lender be.


Quote:> Hi all,

> I need to run a client side script which is generated in a server side
> function. The script opens a window.

> I wasn't sure of the correct (best) way to execute the script. In the
> end the best solution seems to be to dynamically add a label control
> to the page with its text set to my open window script.

> This works but the window is displayed and then the window with the
> main web page is loaded on top of it.

> I could use a timer to make the window (hopefully) have it's focus set
> after this point but it all seems a bit kludgy.

> Any suggestions?

> Mark


 
 
 

Calling client side script from server side event

Post by Mark Evere » Sun, 09 Mar 2003 22:25:26


Heya,

Thanks for the reply.  I used register startup script initially and
yes it works fine when the page first refreshes but it is persistent.
I only want the script to execute once.

If you see what I mean :)

Mark


> Page.RegisterStartupScript("Key", scriptString)

> HTH,

> Kevin Spencer
> Microsoft FrontPage MVP
> Internet Developer
> http://www.takempis.com
> Neither a follower nor a lender be.



> > Hi all,

> > I need to run a client side script which is generated in a server side
> > function. The script opens a window.

> > I wasn't sure of the correct (best) way to execute the script. In the
> > end the best solution seems to be to dynamically add a label control
> > to the page with its text set to my open window script.

> > This works but the window is displayed and then the window with the
> > main web page is loaded on top of it.

> > I could use a timer to make the window (hopefully) have it's focus set
> > after this point but it all seems a bit kludgy.

> > Any suggestions?

> > Mark

 
 
 

Calling client side script from server side event

Post by Kevin Spence » Tue, 11 Mar 2003 23:43:06


Hi Mark,

It's a block of code. You can execute it conditionally, and have the script
appear in the page whenever you want it to.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Different Strangs fer Different Thangs.


> Heya,

> Thanks for the reply.  I used register startup script initially and
> yes it works fine when the page first refreshes but it is persistent.
> I only want the script to execute once.

> If you see what I mean :)

> Mark




> > Page.RegisterStartupScript("Key", scriptString)

> > HTH,

> > Kevin Spencer
> > Microsoft FrontPage MVP
> > Internet Developer
> > http://www.takempis.com
> > Neither a follower nor a lender be.



> > > Hi all,

> > > I need to run a client side script which is generated in a server side
> > > function. The script opens a window.

> > > I wasn't sure of the correct (best) way to execute the script. In the
> > > end the best solution seems to be to dynamically add a label control
> > > to the page with its text set to my open window script.

> > > This works but the window is displayed and then the window with the
> > > main web page is loaded on top of it.

> > > I could use a timer to make the window (hopefully) have it's focus set
> > > after this point but it all seems a bit kludgy.

> > > Any suggestions?

> > > Mark