Solved

ASP.C# controls not being referenced in code-behind

Posted on 2009-07-13
4
237 Views
Last Modified: 2013-11-26
I've been emailed all of the solution files for a website that a colleague has created in VWD Express, which I've copied onto my development machine, which uses VS Team System 2008.

The problem is that VS seems to have 'lost' all of the control declarations in its code-behind pages leaving me with 1174 errors to sort out.

Is this due to something that I may have inadvertently done or is VS just being difficult for the sake of it?

More importantly is there a simple and quick way to rectify this rather than manually add all of the control declarations again?
0
Comment
Question by:Loomy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 24839826
My guess is the original project was developed in .Net 1.1. This declares all the controls in the full code-behind file while .Net 2.0 and above use partial code-behinds. I believe all you need to do is update your <@ Page> directive to be .net 2.0 compliant (namely use the CodeFile="" attribute)
0
 

Author Comment

by:Loomy
ID: 24840017
You're right in that the original project was developed in .Net 1.1 however I was told that this project was working in VWD and my aspx pages already have the CodeFile attribute (see below) but it still doesn't seem to pick up the controls.
<%@ Page language="c#" Inherits="Portal.Admin.EditNewsArticle" validateRequest="False" CodeFile="EditNewsArticle.aspx.cs" %>

Open in new window

0
 
LVL 28

Assisted Solution

by:strickdd
strickdd earned 250 total points
ID: 24841457
It looks like you are missing the Inherits attribute. This is set to the namespace of the partial class (in your case probably "EditNewsArticle" unless it is in a subfolder).

Other than that the issue may lie in the web.config.
0
 

Accepted Solution

by:
Loomy earned 0 total points
ID: 24867825
Thanks for the pointers but nothing seemed to help as even with the relevant attributes in place it still didn't work.

In the end, for each page in the app, I added a new page and copied the html and cs from the old files into the new files, renamed the original file, then renamed the new file to the original filename.

Very time consuming and very tedious but at least it worked.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question