Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-13
4
Medium Priority
?
239 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 1000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

670 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