Question

I have controls in ascx file but i can't see them in intellisense in .cs file.It was working nice before.

I can see the control names in designer.cs file.

I have deleted the Asp.net temp files in AppData folder but still not working.The other user control files in the app can reference coerrectly to it's page controls. What is the problem here ? I use VS2008.

Was it helpful?

Solution 4

I have solved the problem, I have uninstalled and reinstalled VS2008 and it is solved.

OTHER TIPS

Look at the top line of the .ascx page and check out the value of Inherits= and make sure that is has the right namespace.class appropriate for your codebehind. For example if your namespace is ProjectNamespace and your control class is MyControl then it should be ProjectNamespace.MyControl. This can get out of synch if you renamed the ascx file, etc and cause this type of problem.

This happens to me every time I copy a user control from one project to another. The connection between the ascx and the code-behind breaks. This solution is tedious but it gets around the problem:

  1. Create a new User Control. Visual Studio will correctly connect the ascx file to ascx.vb file.

  2. Copy the ascx and vb code from your original control into the new one.

  3. Delete your original control.

  4. You now have a working control, but it has a different name.

  5. If it is important to retain the name of the original control, repeat the whole process again and copy the second control to a third one with the correct name.

  6. Write to Microsoft and ask them to stop adding bells and whistles we don't need and fix the basic stuff!

I just figured this out for my situation: in the Page parameters of the .aspx file, the 'Codefile' parameter was pointing to the file name: 'LabEdit.aspx.cs'. It should have been pointing to the path: "~/WOPages/LabEdit.aspx.cs". I know I didn't move the codefile or the page file, so this is maybe a problem with VS2008

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top