Passing Client side variables

asp.net United States
  • 18 years ago

    Hello,
    I was finishing up a class project for school and was wondering if it is possible to pass the client side variables over to the server side asp.  I keep getting a server error requesting the two missing variables :BDate & EDate.  I didn't want to have to make a seperate asp page to request the info.  Is this still possible?
    <Script Language = "VBScript">
    Dim date1, date2, BDate, EDate
    date1 = InputBox("Enter the Start Date","Input Box", ,1000,1000)
    date2 = InputBox("Enter the End Date","Input Box", ,1000,1000)
    BDate = (date1)
    EDate = (date2)
    </SCRIPT>
    <%
    Dim objCom, oRS, strID
    strID = Session ("ID")
    Set objCom = Server.CreateObject ("ADODB.Command")
    objCom.ActiveConnection = objConn
    objCom.CommandText = "{CALL dbo.qViewOrders ('"&CStr(strID)&"','"&CDate(BDate)&"','"&CDate(EDate)&"')}"
    objCom.CommandType = adCmdText
    Set oRS = Server.CreateObject ("ADODB.Recordset")
    Set oRS = objCom.Execute
    %>

  • 18 years ago

    This can't be done because server side code has already run by the time your client side code asks for those dates. asp and asp.net aplications are parsed by the relevent exe on iis and html is returned according to your server side code. This means you can pass server side variables to be output to client side code.
    The only way to get values from a user and use them in server side code is to get them from a posted form that might ask in your case for the 2 dates.

  • 18 years ago

    I appreciate you taking the time to explain this. Thank you very much.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”