The problem
If you see the following error when trying to load your web form designer :-
The class file for this Web Form was not loaded.
Close this view, correct any errors, then reopen the Web Form.
Then you might have to check the code behind for your
web form carefully. VS.NET complains if you have declared
a class in your aspx.cs file in the following manner :-
public class CustomDropDown : Control public class WebForm1 : System.Web.UI.Page
{
}
In other words, you have created a class outside
the web form's Page class. The weird thing is that
it will compile just fine. But when you try to visit the web
form designer for your page, you'll either get the error message I described,
or your web designer will behave in a funny manner.
The quick solution
Remove the offending class and either place it
within your Page class or in a separate
class file (my preferred solution).
Thoughts
Some of you might know the technical reason for this behavior
and as such might scoff at this "obvious" workaround, but my argument
is that the code compiles fine. As such it shouldn't have such a drastic
effect on the forms designer in my opinion. And the error message implies
that your code is wrong, which I don't think it is. But if anyone can educate me, then
please let me know what is the difference between declaring a class outside
my Page class (but within the same namespace) and in a
separate file altogether (again within the same namespace)
Another Workaround (update)
Jamie Nordemeyer informs me that placing the above class
simply under the Page class also
solves the problem.
public class WebForm1 : System.Web.UI.Page public class CustomDropDown : Control
Thanks Jamie!!