Web Development

General discussion


Javascript Variable

By drhue ·
I am creating a VB.NET Web App. Due to the customer's requirements i must pass an ASP.NET variable to the Javascript. How do i do this?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Ed Woychowsky In reply to Javascript Variable

How about via a hidden HTML control, <input type="hidden"/>. Set the value in VB .Net and retrieve it in JavaScript using the document object.

Collapse -

by bluelizard In reply to Javascript Variable

How about something like this:

'VB.NET code
Dim Foo As Double = 3.14159
<script language="JavaScript">
var foo = <%= Foo.ToString() %>;
// now do something with foo

Related Discussions

Related Forums