错误:当前上下文中不存在名称“txt_name” [英] ERROR: The name 'txt_name' does not exist in the current context

查看:482
本文介绍了错误:当前上下文中不存在名称“txt_name”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Web应用程序,但在运行时会出现此错误。

i写入页面.apsx.designer.cs

protected global :: System。 Web.UI.HtmlControls.HtmlInputText txt_name;

但仍然给我这个错误

怎么办?











汇编错误



描述:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并相应地修改源代码。



编译错误消息:CS0103:当前上下文中不存在名称''txt_name''



来源错误:





第68行:if(!Page.IsPostBack)

第69行: {

第70行:txt_name.Disabled = true;

第71行:txt_surname.Disabled = true;

第72行:txt_sity.Disabled = true;

i am building a web app but results this error when i run it.
i wrote to the page .apsx.designer.cs
protected global::System.Web.UI.HtmlControls.HtmlInputText txt_name;
BUT still give me this error
WHAT TO DO??





Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name ''txt_name'' does not exist in the current context

Source Error:


Line 68: if (!Page.IsPostBack)
Line 69: {
Line 70: txt_name.Disabled = true;
Line 71: txt_surname.Disabled = true;
Line 72: txt_sity.Disabled = true;

推荐答案

在aspx页面中放置文本框的asp.net控件并在每个文本框中写入runat =Server属性
Hey Put asp.net Controls of textbox in the aspx page and write runat="Server" property in every textbox


这篇关于错误:当前上下文中不存在名称“txt_name”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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