Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Pass ASP.NET/VB.NET variable to javascript (http://www.velocityreviews.com/forums/t584692-pass-asp-net-vb-net-variable-to-javascript.html)

Mike 01-15-2008 05:06 AM

Pass ASP.NET/VB.NET variable to javascript
 
I don't think this is possible, but here goes.

I have a webform containing a javascript method. The javascript method is
fired when the page loads and it populates some client-side input controls.
In the code's page load event, data populates into some server-side controls.

When the page load event occurrs, can I somehow pass a variable to the
javascript method and reexecute the javascript method (remember it was
already executed once when the page loaded). Is this possible?

I'm using ASP.NET 2.0 with AJAX.

Thanks,
Mike

Leon Mayne 01-15-2008 09:23 AM

Re: Pass ASP.NET/VB.NET variable to javascript
 
"Mike" <Mike@discussions.microsoft.com> wrote in message
news:4CEA6CC0-84BF-40A3-8183-F8AF418892FB@microsoft.com...
>I don't think this is possible, but here goes.
>
> I have a webform containing a javascript method. The javascript method is
> fired when the page loads and it populates some client-side input
> controls.
> In the code's page load event, data populates into some server-side
> controls.
>
> When the page load event occurrs, can I somehow pass a variable to the
> javascript method and reexecute the javascript method (remember it was
> already executed once when the page loaded). Is this possible?


I don't see why not. You won't need to execute the javascript yourself,
because the server side processing will run first, and then the client side
load event will fire. It will always fire after a postback has occured. The
fact it already fired once is irrelevant.


Eliyahu Goldin 01-15-2008 01:25 PM

Re: Pass ASP.NET/VB.NET variable to javascript
 
This may help you:

How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage.a...rAndClient.htm

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Mike" <Mike@discussions.microsoft.com> wrote in message
news:4CEA6CC0-84BF-40A3-8183-F8AF418892FB@microsoft.com...
>I don't think this is possible, but here goes.
>
> I have a webform containing a javascript method. The javascript method is
> fired when the page loads and it populates some client-side input
> controls.
> In the code's page load event, data populates into some server-side
> controls.
>
> When the page load event occurrs, can I somehow pass a variable to the
> javascript method and reexecute the javascript method (remember it was
> already executed once when the page loaded). Is this possible?
>
> I'm using ASP.NET 2.0 with AJAX.
>
> Thanks,
> Mike





All times are GMT. The time now is 07:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.