General discussion

Locked

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.

2 total posts (Page 1 of 1)  
| 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
</script>

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums