Pass ASP.NET/VB.NET variable to javascript

M

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
 
L

Leon Mayne

Mike said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top