There is no need for you to declare the textbox in the code behind. The code declaration for the texbox is created automatically by the runtime when the aspx page is parsed.
May I suggest that you have a look at
this article which explains the process in detail and should help clarify things for you.
pablodarde
Member
10 Points
2 Posts
CS0102: The type '_Default' already contains a definition for 'txtNome'
Apr 27, 2006 05:59 PM|LINK
Hi friends, I did a webform with textboxes and I'm with the folowing problems:
textbox name: txtNome
BEFORE: error: the "txtNome" does not exist in the current context
Then I did put the code in the "code-behind":
"...
protected System.Web.UI.WebControls.TextBox txtNome;
... "
AFTER: error: CS0102: The type '_Default' already contains a definition for 'txtNome'
Please help me! Thanks
James Steele
Participant
875 Points
173 Posts
Re: CS0102: The type '_Default' already contains a definition for 'txtNome'
Apr 27, 2006 07:32 PM|LINK
Hi pablodarde,
Your webform should have declarative code for the textbox that looks like line 1 or line 2:
In your code behind page you can reference the controls as follows:There is no need for you to declare the textbox in the code behind. The code declaration for the texbox is created automatically by the runtime when the aspx page is parsed.
May I suggest that you have a look at this article which explains the process in detail and should help clarify things for you.
Let me know how you make out!
James Steele