Pass ASP.NET/VB.NET variable to javascript
am 15.01.2008 06:06:01 von Mike
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
Re: Pass ASP.NET/VB.NET variable to javascript
am 15.01.2008 10:23:27 von Leon Mayne
"Mike" 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.
Re: Pass ASP.NET/VB.NET variable to javascript
am 15.01.2008 14:25:00 von Eliyahu Goldin
This may help you:
How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage.aspx?page=Articles/HowTo/ HowToPassMessagesBetweenServerAndClient.htm
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Mike" 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