views:

309

answers:

5

Greetings.

I've got a web site project loaded into Visual Studio 2008. The .designer files for all of my ascx controls are not nested under the control in solution explorer, and when I reference something in that control in the code behind, I don't get intellisense.

I've checked the csproj xml file, and the 'compile' elements appear to be the same as those in my other projects where this is working correctly. An example looks like this:

<Compile Include="Default.aspx.cs">
  <DependentUpon>Default.aspx</DependentUpon>
  <SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Default.aspx.designer.cs">
  <DependentUpon>Default.aspx</DependentUpon>
</Compile>

I've tried playing with the project file, using the Website\Nest Related Files menu command, and everything else that I can think of. Any ideas?

UPDATE

Note that I'm trying to nest files that should be nested already.

A: 

Made sure both partial files are the same namespace and class name? Might also try to remove them and add both files back at the same time.

CSharpAtl
A: 

I ran across this macro a while back to do exactly what you're looking for. The author even posted a video of how to use it. I have never tried it though, so I can't vouch for it.

womp
A: 

I do not think the nesting is an issue for you, seeing nested files is just a eye candy although depends upon matters... Not getting intellisense is not really a factor of nesting but rather something to do with the way references are hooked up for your project... Can you share whether this happens everytime you create a new project or is it for a specific project...? Did you try compiling the project? Does intellisense come back after compiling... Typically for WAP projects if for somereason intellisense does not become available it should come after you compile the project... Let me know if are still facing this issues... -Vishal

Vishal R. Joshi
A: 

I don't know if the OP ever fixed his issue, but something very similar is happening to me. The designer.vb files aren't nesting, Intellisense isn't working, etc... The main difference is that I'm not using ascx, I'm using straight up .aspx pages with .vb codebehinds. It appears as though all the controls placed on the aspx page do not appear to VS as declared when I go to manipulate said controls in the codebehind. I get an error list hundreds deep from code I wrote months ago (having no problems with at the time), most of them saying "Name 'objectname' is not declared" where 'objectname' is a textbox, or dropdown menu from the associated aspx page. To answer Vishal's questions...

Can you share whether this happens everytime you create a new project or is it for a specific project...?

It's happening to one project. I have multiple other applications in VS2008 showing no problems.

Did you try compiling the project?

Yes, when I compile it lists out all the build errors that show up in the ErrorList aborts, and kicks over to the ErrorList.

Does intellisense come back after compiling

No.

A little more information on this project: It's a converted VS 2003 project. These problems did not start immediately after conversion from 2003. The conversion happened months ago and I made numerous revisions to the web app since then. There's currently a version with those revisions on a test server to show off new functionality to the client. This problem only cropped up 3 business days ago when I went in to make a few formatting changes to the aspx page. I never got a chance to make those changes however because as soon as I opened the project I got the error list. This issue is affecting every aspx page I have in the project.

+1  A: 

This is a response to my own previous post. Got MS Tech Support to straighten it out. On my .aspx pages changing line one in 2 places solved the issue for me.

In the line in each .aspx file in your project that starts "<%Page Language" change "Codebehind=" to "Codefile=", and in your "Inherits=" property if it's set up as ProjectName.FileName then remove the "ProjectName.".

For example if you had a Project named "TestApp" and a file inside it called "NewFunctionalityTest.aspx" change

Inherits="TestApp.NewFunctionalityTest"

to

Inherits="NewFunctionalityTest"

in the first line.