Blog Stats
  • Posts - 178
  • Articles - 0
  • Comments - 52
  • Trackbacks - 175

 

Very Strange VS.NET 2003 Problem

VS.NET 03 is driving me NUTS!!! When I create a new ASP.NET user control and drop it on a web form, for some strange reason, it doesn't add the 'protected user.control.namespace.control.name uControl' declaration to the web form's Code Behind file. I have uninstalled and re-installed VS.NET and created a blank project to test if there was something about that particular project that was causing the screw-up, all to no avail. The last thing to do is format my hard drive and re-install everything. Fortuanately, I have a Ghost image of the computer so it should not be a huge problem but what a waste of time. I searched the MSKB for a fix but no help there either.

I don't expect any one to have a fix but if you have seen this before, let me know how you fixed it.

Feedback

# re: Very Strange VS.NET 2003 Problem

Gravatar It's because you added the control in via the toolbar not via the Project References. It's an odd VS.NET 2003 bug. 2/24/2005 10:07 AM | Brock Allen

# re: Very Strange VS.NET 2003 Problem

Gravatar That does not seem to be the problem. Both the user control and the web form are in the same project. 2/24/2005 12:32 PM | Jason Bentley

# re: Very Strange VS.NET 2003 Problem

Gravatar Jason, UserControl DO NOT get added automatically to the code-behind. This is by design, and in my humble opinion pretty stupid. As you, I think they should be but only server controls bet auto-added. Even then, I've had problems where sometimes it takes a while for the server control declaration to get auto-added (or maybe a couple of free-form clicks on the form). However, I will tell you that UserControls must be added manually and of course you have to make sure the names match from the ASPX page to the code-behind page. Don't forget to declare them WithEvents if you're using VB.NET. -- good luck 2/24/2005 2:09 PM | Miguel Castro

# re: Very Strange VS.NET 2003 Problem

Gravatar Ooops, my bad -- I misread and thought you were working with a custom/composite control.

Yeah, so Miquel's right. You'll have to manually add the User Control's base class as a protected field in your codebehind. 2/24/2005 2:44 PM | Brock Allen

Post a comment





 

Please add 7 and 4 and type the answer here:

 

 

Copyright © Jason Bentley