Share ASP.NET variables with JavaScript

Want to share ASP.NET variables with JavaScript? This Visual Basic code snippet will let you do just that.

Want to share ASP.NET variables with JavaScript? This Visual Basic code snippet will let you do just that.
<%@ Page Language="VB" Explicit="True">
<script runat="server">

  Dim sCurrentState As String

</script>

<html>
<head>
<script language="JavaScript">
<!--
  var currentState = <% Response.Write(CurrentState) %>;
  var pageIsPostBack = <% Response.Write(LCase(Page.IsPostBack)) %>;

// -->
</script>
</head>
<body>
</body>
</html>
This was first published in January 2005

Dig deeper on ASP.NET development best practices

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close