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="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostB ack)
{
}
else
{
//get name from TextBox
string myVar =name.Value;
//add name to session
Session.Add("se ssionVar1", myVar);
//store session var in a hidden input so it can be retrieved from
VBScript
string retrievedSessio nVar=(string) Session["sessionVar 1"];
//show that var was retrieved successfully
HiddenInput1.Va lue = retrievedSessio nVar;
}
}
</script>
<script language="vbscr ipt">
private sub fill(HiddenInpu t1)
dim Name
Name = HiddenInput1.va lue
retrieve(Name)
end sub
private sub retrieve(Name)
name2.value=Nam e
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(H iddenInput1)"
runat="server">
<br>
<br>
<input type="text" id="HiddenInput 1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>