Advertisement

06.17.2008 at 12:54PM PDT, ID: 23493034
[x]
Attachment Details

Simple VB.net passing a variable from .vb to .aspx

Asked by drocco21 in Visual Studio, Microsoft Visual Basic.Net

Tags:

This is a really simple issue, but I have racked my brain on how to get these values over. I am knowledgable on asp classic but .net has me lost. All of the code I am using, or trying to use, is vb. In classic asp I could easily set a variable and say that <%test_value = 1%> then call it later by saying <%response.write test_value%>.

I basically am trying to learn how to do this simple task in VB but I am feeling stupid on why I cannot make it happen. I am trying to do the same thing but in the .vb file, and pull the value into the .aspx file.

Below is a very simple string that I want to work, which does not. I think I am attaching myself to classic and making it more difficult than it is in .net. Thanks for your help!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
---.vb file---
 
Partial Class _Default
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim test_value = "25"
    End Sub
 
End Class
 
 
 
 
 
 
---.aspx file---
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <%Response.Write(test_value)%>
    <div>
    </div>
    </form>
</body>
</html>
[+][-]06.17.2008 at 01:05PM PDT, ID: 21806951

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 03:34PM PDT, ID: 21808052

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 06:34PM PDT, ID: 21809179

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 01:08AM PDT, ID: 21810933

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio, Microsoft Visual Basic.Net
Tags: Visual Basic
Sign Up Now!
Solution Provided By: adrian213
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.18.2008 at 04:48AM PDT, ID: 21811841

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 05:28AM PDT, ID: 21812077

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628