B
Bob T
Hi All,
I am trying to pass a variable from my VB asp.net script (from for example
Sub Page_Load in mypage.aspx.vb) to my Client side script.
I have found and looked at a very good example "Client and Server Scripting
in Web Pages" but it only shows server side scripting that is written in
HTML in mypage.aspx and not script from mypage.aspx.vb. How can I pass a
variable value from mypage.aspx.vp to my client side script?
Sample from "Client and Server Scripting in Web Pages"
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<% Dim strMyServerVar
strMyServerVar = 42 %>
.........
The following line of HTML was generated on the client to print the value of
a client variable into the page after the page was sent to the browser. The
value of the client variable has been set equal to the value of the server
variable printed above.
<BR>
<BR>
<SCRIPT LANGUAGE = "JavaScript">
<!---
var x ;
x = <%= strMyServerVar %> ;
if (x == <%= strMyServerVar%>) {
document.write ("<STRONG>The value of the client variable is " + x +
".</STRONG>")
}
//
--->
</SCRIPT>
I am trying to pass a variable from my VB asp.net script (from for example
Sub Page_Load in mypage.aspx.vb) to my Client side script.
I have found and looked at a very good example "Client and Server Scripting
in Web Pages" but it only shows server side scripting that is written in
HTML in mypage.aspx and not script from mypage.aspx.vb. How can I pass a
variable value from mypage.aspx.vp to my client side script?
Sample from "Client and Server Scripting in Web Pages"
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<% Dim strMyServerVar
strMyServerVar = 42 %>
.........
The following line of HTML was generated on the client to print the value of
a client variable into the page after the page was sent to the browser. The
value of the client variable has been set equal to the value of the server
variable printed above.
<BR>
<BR>
<SCRIPT LANGUAGE = "JavaScript">
<!---
var x ;
x = <%= strMyServerVar %> ;
if (x == <%= strMyServerVar%>) {
document.write ("<STRONG>The value of the client variable is " + x +
".</STRONG>")
}
//
--->
</SCRIPT>