After putting a textbox on my page when I compile it I get the above error:
'txtName' is not declared. It may be inaccessible due to its protection level.
This is happening when I try to read the value of the textbox in the codebehind page.
I'm not sure what's causing this...any ideas?
In the aspx file I have:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="signup.aspx.vb" Inherits="signup" %>
In the codebehind aspx.vb file I have:
Imports System.Data.SqlClient
Partial Class signup
Inherits System.Web.UI.Page
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Ok, I have this resolved now. It was becuase I had renamed a copy of the .aspx file and which still using the newer versions code behind file.
The code behind file was looking for txtName.text but on the older version of the .aspx file txtName didnt exist!
I have excluded the older version of the page from the project and it appears to run ok now.
Thanks everyone for you help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With