Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Behind code problem

$
0
0

Hi guys i'm new to this forum and new to ASP.

However not new to programming (I know PHP & abit of Java)

I'm currently stuck on a little something i'm working on. As far as I understand you can have a 'behind code' aspx.vb file which basically seperates your logic from your views.

So I have a page default.aspx.vb with this in it:

Public Class _Default
    Inherits System.Web.UI.Page

    Public adult As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        adult = "test"
    End Sub

End Class

and a default.aspx with this:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="DatabaseExample._Default" %><%@ Import Namespace="System.Data.OleDb"%><%= adult %>


As I understand adult should already be declared and available for use in my normal .aspx file

Why is it i'm still getting this error stating it's undeclared:

Compiler Error Message: BC30451: 'adult' is not declared. It may be inaccessible due to its protection level.a

Can somebody explain this to me please?


Viewing all articles
Browse latest Browse all 23244

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>