473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Cannot get Client Side VBscript variables to ASP.NET page

Hi,

I have the following code where there is some client side VBScript that
does something and needs to pass a variable back to the ASP.NET page.
When the page is updated through a postback, the information is lost.
What am I doing wrong?

After obtaining the variable, I assign it back to a Label text field on
the form, it shows up on the web page no problem.

During postback, the variable for the Label text field is blank.

Thanks for your help!


<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Main.aspx.vb" Inherits="ASP1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Title</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="VBScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<OBJECT id="PBDSIO" codeBase="Project1.dll" classid="CLSID:xxxxxxxxx"
VIEWASTEXT></OBJECT>
<script language="vbscript">
sub FindDVD
dim aVariable
dim FoundIt

aVariable = document.All.item("tbScan").innertext
msgbox (aVariable) '<- Variable is seen here ->'
aVariable = PBDSIO.findDVDMedia("MediaName")
if instr(aVariable,"Not Found") < 1 then
aVariable = "Media Not Found"
end if

document.All.item("tbScan").innertext = aVariable '<- Variable is
seen here on web page ->'

end sub
</script>
</HEAD>
<body bgColor="#cccc99" onload="FindDVD" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">

<asp:button id="bLog" style="Z-INDEX: 101; LEFT: 336px; POSITION:
absolute; TOP: 144px" runat="server" Text="Login" Width="64px">
</asp:button>

<asp:Label id="tbScan" style="Z-INDEX: 111; LEFT: 136px; POSITION:
absolute; TOP: 536px" runat="server" Width="256px"></asp:Label>

<asp:listbox id="lHospitalList" style="Z-INDEX: 110; LEFT: 32px;
POSITION: absolute; TOP: 456px" runat="server" Width="128px"
AutoPostBack="True" Visible="False" Height="32px"></asp:listbox>

<asp:label id="Label1" style="Z-INDEX: 103; LEFT: 96px; POSITION:
absolute; TOP: 120px" runat="server" Width="96px">Name</asp:label>

<asp:label id="Label2" style="Z-INDEX: 104; LEFT: 96px; POSITION:
absolute; TOP: 176px" runat="server" Width="102px">Password</asp:label>

<asp:textbox id="tName" style="Z-INDEX: 105; LEFT: 96px; POSITION:
absolute; TOP: 144px" runat="server" Width="224px"></asp:textbox>

<asp:textbox id="tPassword" style="Z-INDEX: 106; LEFT: 96px; POSITION:
absolute; TOP: 200px" runat="server" Width="224px" TextMode="Password">
</asp:textbox>
</form>
</body>
</HTML>
Nov 19 '05 #1
2 2561
browsers do not postback most html elements, only <input> and <select>
elements.
you should us a hidden field.

-- bruce (sqlwork.com)
"ChucRock @pmsi-pbds.com>" <chuck<remove> wrote in message
news:Xn**************************@216.196.97.131.. .
Hi,

I have the following code where there is some client side VBScript that
does something and needs to pass a variable back to the ASP.NET page.
When the page is updated through a postback, the information is lost.
What am I doing wrong?

After obtaining the variable, I assign it back to a Label text field on
the form, it shows up on the web page no problem.

During postback, the variable for the Label text field is blank.

Thanks for your help!


<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Main.aspx.vb" Inherits="ASP1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Title</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="VBScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<OBJECT id="PBDSIO" codeBase="Project1.dll" classid="CLSID:xxxxxxxxx"
VIEWASTEXT></OBJECT>
<script language="vbscript">
sub FindDVD
dim aVariable
dim FoundIt

aVariable = document.All.item("tbScan").innertext
msgbox (aVariable) '<- Variable is seen here ->'
aVariable = PBDSIO.findDVDMedia("MediaName")
if instr(aVariable,"Not Found") < 1 then
aVariable = "Media Not Found"
end if

document.All.item("tbScan").innertext = aVariable '<- Variable is
seen here on web page ->'

end sub
</script>
</HEAD>
<body bgColor="#cccc99" onload="FindDVD" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">

<asp:button id="bLog" style="Z-INDEX: 101; LEFT: 336px; POSITION:
absolute; TOP: 144px" runat="server" Text="Login" Width="64px">
</asp:button>

<asp:Label id="tbScan" style="Z-INDEX: 111; LEFT: 136px; POSITION:
absolute; TOP: 536px" runat="server" Width="256px"></asp:Label>

<asp:listbox id="lHospitalList" style="Z-INDEX: 110; LEFT: 32px;
POSITION: absolute; TOP: 456px" runat="server" Width="128px"
AutoPostBack="True" Visible="False" Height="32px"></asp:listbox>

<asp:label id="Label1" style="Z-INDEX: 103; LEFT: 96px; POSITION:
absolute; TOP: 120px" runat="server" Width="96px">Name</asp:label>

<asp:label id="Label2" style="Z-INDEX: 104; LEFT: 96px; POSITION:
absolute; TOP: 176px" runat="server" Width="102px">Password</asp:label>

<asp:textbox id="tName" style="Z-INDEX: 105; LEFT: 96px; POSITION:
absolute; TOP: 144px" runat="server" Width="224px"></asp:textbox>

<asp:textbox id="tPassword" style="Z-INDEX: 106; LEFT: 96px; POSITION:
absolute; TOP: 200px" runat="server" Width="224px" TextMode="Password">
</asp:textbox>
</form>
</body>
</HTML>

Nov 19 '05 #2
ChucRock <chuck<remove>@pmsi-pbds.com> wrote in
news:Xn**************************@216.196.97.131:
I have the following code where there is some client side VBScript that
does something and needs to pass a variable back to the ASP.NET page.
When the page is updated through a postback, the information is lost.
What am I doing wrong?

After obtaining the variable, I assign it back to a Label text field on
the form, it shows up on the web page no problem.


Labels don't send postback information... you'll need to place the
information in a form field. Or perhaps the querystring... or maybe even a
cookie.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
2
by: Bill S. | last post by:
I am starting to build quite a few pages that will have tables of data from an SQL database. I have been building the table rows on the server side in VBScript, but I have been thinking about...
1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
3
by: David Shorthouse | last post by:
Hey folks, Not an off-topic posting.....since I was shot-down in an earlier post...this one's legit. How do I go about calling a server-side vbscript within a client-side javascript function?...
7
by: Mike Rand | last post by:
I am having a really hard time trying to get some client side code hooked up in VS2005, ASP 2.0. The code is in an .inc file (vbscript). The first problem I am encountering is the ASP.NET page...
7
by: dinamointer | last post by:
Could you help me in this problem: I want to launch an exe file(executable jar file) from a web page. I use jsp...and i cannot use vbScript...? could u tell me how should i do it? Thanks
6
by: JimLad | last post by:
Hi, We have a major ASP app that we are in the process of upgrading to ASP.NET 1.1 and probably on to ASP.NET 2.0 in the middle of next year. (We will also be upgrading to SQL2K5 at the same...
5
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT...
1
by: Chris | last post by:
Hi, I have jsut started to learn ASP development and have read many articles regarding which is the best to use regarding JavaScript or VBScript. All of the learning that I have done so far has...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.