Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# C#4.0
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


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;
Posted 7-Dec-12 2:35am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hey Put Controls of textbox in the aspx page and write runat="Server" property in every textbox
Annnaa at 7-Dec-12 7:45am
still gives me the error :/
Annnaa at 7-Dec-12 7:46am
& its very strange cuz in another page aspx.cs, i did the same thing and doesnt give any error
Devang Vaja at 7-Dec-12 7:48am
close visual studio and reopen and make one another page copy same code there
Annnaa at 7-Dec-12 7:55am
still gives the same error :(
Devang Vaja at 7-Dec-12 8:01am
use this protected global::System.Web.UI.WebControls.TextBox txt_name;
Annnaa at 7-Dec-12 8:12am
It worked, thnx :)
Devang Vaja at 7-Dec-12 8:14am
welcome HappY CoDiNg:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294

Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100