Workaround: Missing Declarations for Controls in Designer File

Web Development Tools Microsoft

We have seen some customers report the issue that certain controls are not getting generated correctly in the designer file in Visual Studio 2010 RC for the ASP.Net Web Application Projects.

We are currently working on a fix for this issue for the final RTM release.

Workaround:

You can work-around this issue by declaring the missing controls in the code behind file for the ASPX page.

Example:

When you add a Button control with ID as “Button1” to the aspx page normally you should see the following code be generated in the designer file for this control.

VB:

  • Protected WithEvents Button1 As Global.System.Web.UI.WebControls.Button

C#:

  • protected global::System.Web.UI.WebControls.Button Button1;

If this code is not being generated in the designer file you can work around this by adding this same declaration in the code behind file of the ASPX page for the web application projects.

VB: (*.aspx.vb)

clip_image002

CS: (*.aspx.cs)

clip_image004

Note:

If you have older versions of the project with the correct designer file you can work around this problem by simply cutting and pasting the missing controls from the older designer file to the code-behind file.

With this work around you will need to manually maintain these declarations when trying to rename/remove/add controls.

–Mayuri

0 comments

Discussion is closed.

Feedback usabilla icon