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 last published in January 2005

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close