Re: Cannot get Client Side VBscript variables to ASP.NET page

Tech-Archive recommends: Speed Up your PC by fixing your registry



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:Xns9639744BDF61Ebadsingernet@xxxxxxxxxxxxxxxxx
> 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>


.


Quantcast