473,595 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Mai n.aspx.vb" Inherits="ASP1. WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Title</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="VBScri pt" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<OBJECT id="PBDSIO" codeBase="Proje ct1.dll" classid="CLSID: xxxxxxxxx"
VIEWASTEXT></OBJECT>
<script language="vbscr ipt">
sub FindDVD
dim aVariable
dim FoundIt

aVariable = document.All.it em("tbScan").in nertext
msgbox (aVariable) '<- Variable is seen here ->'
aVariable = PBDSIO.findDVDM edia("MediaName ")
if instr(aVariable ,"Not Found") < 1 then
aVariable = "Media Not Found"
end if

document.All.it em("tbScan").in nertext = aVariable '<- Variable is
seen here on web page ->'

end sub
</script>
</HEAD>
<body bgColor="#cccc9 9" 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="lHospitalLi st" style="Z-INDEX: 110; LEFT: 32px;
POSITION: absolute; TOP: 456px" runat="server" Width="128px"
AutoPostBack="T rue" Visible="False" Height="32px"></asp:listbox>

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

<asp:label id="Label2" style="Z-INDEX: 104; LEFT: 96px; POSITION:
absolute; TOP: 176px" runat="server" Width="102px">P assword</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="Passw ord">
</asp:textbox>
</form>
</body>
</HTML>
Nov 19 '05 #1
2 2586
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="Mai n.aspx.vb" Inherits="ASP1. WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Title</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="VBScri pt" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<OBJECT id="PBDSIO" codeBase="Proje ct1.dll" classid="CLSID: xxxxxxxxx"
VIEWASTEXT></OBJECT>
<script language="vbscr ipt">
sub FindDVD
dim aVariable
dim FoundIt

aVariable = document.All.it em("tbScan").in nertext
msgbox (aVariable) '<- Variable is seen here ->'
aVariable = PBDSIO.findDVDM edia("MediaName ")
if instr(aVariable ,"Not Found") < 1 then
aVariable = "Media Not Found"
end if

document.All.it em("tbScan").in nertext = aVariable '<- Variable is
seen here on web page ->'

end sub
</script>
</HEAD>
<body bgColor="#cccc9 9" 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="lHospitalLi st" style="Z-INDEX: 110; LEFT: 32px;
POSITION: absolute; TOP: 456px" runat="server" Width="128px"
AutoPostBack="T rue" Visible="False" Height="32px"></asp:listbox>

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

<asp:label id="Label2" style="Z-INDEX: 104; LEFT: 96px; POSITION:
absolute; TOP: 176px" runat="server" Width="102px">P assword</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="Passw ord">
</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********@rog ers.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
4324
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 vbscript reads the database and populates a listbox on the page with the first field from each record in the recordset. This works fine. - User selects an option on the listbox and, using the OnChange, I
2
1907
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 having the VBScript code just build array variables in the <head> section (or as local variables), and then have JavaScript functions on the client side actually populate the tables when the page loads.
1
7960
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 : VBScript and Javascript Client : 1. IE browser. 2. VBForm embedded with WebBrowser control (MS Internet
3
6773
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? What I have is a page heavy on the javascript that has a number of functions, one of which is to begin a visual countdown with an onclick and also open an asp page containing the server-side vbscript, which initiates a wake-on-lan call. I had no...
7
1603
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 doesn't like vbscript and throws fits about the syntax. Second, the page throws fits about the server side code tags (<% ... %>),...are these supported anymore? Third, when I set the onclick event of a client side HTML button it does not recognize...
7
6161
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
1599
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 time). The current architecture is heavily based on the client side, both for validation and data access. The asp page is returned and then data is modified or selected using XMLHTTP objects embedded on the page, which post or get to a data...
5
1667
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 - e.g. <img ... / - was FULLY Loaded into web Browser
1
3136
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 been using VBScript. I have done the usual database connection and querying stuff using VBScript in my tutorials and have noticed that my code doesnt work when using Mozilla Firefox as VBScript is a Micorsoft language and
0
7955
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8251
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6674
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5418
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3873
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2391
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1490
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.