“txtName的”未声明。它可能无法访问由于其保护级别 [英] 'txtName' is not declared. It may be inaccessible due to its protection level

查看:467
本文介绍了“txtName的”未声明。它可能无法访问由于其保护级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

把一个文本框,我的网页上后,当我编译它,我得到上述错误:

txtName的'未声明。它可能无法访问由于其保护水平。

当我尝试读取codebehind页文本框的值,这是发生了。

我不知道是什么导致这...任何想法?

在aspx文件我有:

 <%@页面语言=VBAutoEventWireup =false的codeFILE =signup.aspx.vb继承=注册%GT;

在codebehind aspx.vb文件我有:

 进口System.Data.SqlClient的
局部类注册
    继承System.Web.UI.Page    保护小组btnSubmit_Click(BYVAL发件人为对象,BYVAL E上System.EventArgs)把手btnSubmit.Click


解决方案

好吧,我现在这样解决了。有人监守我已经改名为.aspx文件和仍然使用隐藏文件的更新版本code的副本。

隐藏文件的code一直在寻找txtName.text但旧版本的.aspx文件的txtName的剪掉存在!

我已经排除从项目页面的旧版本,它似乎现在就ok运行。

谢谢大家对你有所帮助。

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.

这篇关于“txtName的”未声明。它可能无法访问由于其保护级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆