What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

Solved: “The name 'GridView1' does not exist in the current context” after renaming the page / namespace

After I renamed the page and namespace for my aspx page, I started getting a compilation error:

 

The name 'GridView1' does not exist in the current context”.  This was odd since the aspx codebehind and inherits attributes were in sync with the aspx.cs and aspx.designer.cs files.   So what was wrong?

 

During my rename operation, Visual Studio (or possibly ReSharper) excluded the designer file from my project.  I hadn’t noticed because I usually work with the “Show All Files” option enabled in my solution explorer.

 

The Fix: Simple.  Add the excluded designer files back into Visual Studio and Compile.

 

All Better!

Print | posted on Sunday, September 19, 2010 6:17 PM | Filed Under [ Visual Studio ]

Feedback

Gravatar

# re: Solved: “The name 'GridView1' does not exist in the current context” after renaming the page / namespace

how to add the designer file
10/12/2013 4:16 PM | Ehsan
Gravatar

# re: Solved: “The name 'GridView1' does not exist in the current context” after renaming the page / namespace

I am facing the same problem
lot of people advising to change the designer file but how
????
10/13/2013 8:48 AM | eagle
Gravatar

# re: Solved: “The name 'GridView1' does not exist in the current context” after renaming the page / namespace

how to add the excluded designer file back to visual studio
8/10/2015 2:05 AM | praveen
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: