F
Frank
Can I do this?
I add a session var in C# and ultimatly want to pass it into a vbscript
client side activeX control. This is what I have so far but get " Object
Required:'name2' " error.
Can anyone suggest a btter way of passing a session var into a vbscript
function?
<%@ Page language="c#" debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostBack)
{
}
else
{
//get name from TextBox
string myVar =name.Value;
//add name to session
Session.Add("sessionVar1", myVar);
//store session var in a hidden input so it can be retrieved from
VBScript
string retrievedSessionVar=(string) Session["sessionVar1"];
//show that var was retrieved successfully
HiddenInput1.Value = retrievedSessionVar;
}
}
</script>
<script language="vbscript">
private sub fill(HiddenInput1)
dim Name
Name = HiddenInput1.value
retrieve(Name)
end sub
private sub retrieve(Name)
name2.value=Name
end sub
</script>
<html>
<head>
<title>Test</title>
</head>
<body>
<form>
<p>
<input type="text" ID="name" Value="Frank" runat="server">
simply stores and shows the session var value </p>
<p><br>
<input type="text" ID="name2" name="name2">
This is the box that should display the session var via the vbscript
</p>
<p><br>
<input type="button" value="Fill" onclick="fill(HiddenInput1)"
runat="server">
<br>
<br>
<input type="text" id="HiddenInput1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>
I add a session var in C# and ultimatly want to pass it into a vbscript
client side activeX control. This is what I have so far but get " Object
Required:'name2' " error.
Can anyone suggest a btter way of passing a session var into a vbscript
function?
<%@ Page language="c#" debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostBack)
{
}
else
{
//get name from TextBox
string myVar =name.Value;
//add name to session
Session.Add("sessionVar1", myVar);
//store session var in a hidden input so it can be retrieved from
VBScript
string retrievedSessionVar=(string) Session["sessionVar1"];
//show that var was retrieved successfully
HiddenInput1.Value = retrievedSessionVar;
}
}
</script>
<script language="vbscript">
private sub fill(HiddenInput1)
dim Name
Name = HiddenInput1.value
retrieve(Name)
end sub
private sub retrieve(Name)
name2.value=Name
end sub
</script>
<html>
<head>
<title>Test</title>
</head>
<body>
<form>
<p>
<input type="text" ID="name" Value="Frank" runat="server">
simply stores and shows the session var value </p>
<p><br>
<input type="text" ID="name2" name="name2">
This is the box that should display the session var via the vbscript
</p>
<p><br>
<input type="button" value="Fill" onclick="fill(HiddenInput1)"
runat="server">
<br>
<br>
<input type="text" id="HiddenInput1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>