views:

157

answers:

1

I'm using Visual Studio 2008. I've added a control on a page but can't reference it in code-behind file. When I looked at the Code-Gen file, I didn't find my new control. It looks like Visual Studio didn't update Code Gen file to include my control. Is there a way to manually re-generate that Code Gen file?

+2  A: 

If you want to refresh the designer file, you can create it like this:

  • Delete the [NameHere].aspx.designer.cs file.
  • Right click the [NameHere].aspx file.
  • Click Convert to Web Application.
  • Designer file is now re-created, or an error is thrown, letting you know what the issue is with the generation...given your case this is likely, but it'll let you know what to fix, then just click "Convert to Web Application" again once it's fixed.
Nick Craver
I don't see that option in my context menu. I know it should be there http://i.imgur.com/GfiIW.gif I wonder why it isn't there for me.
dev.e.loper
@dev.e.loper - It won't appear until you delete the designer file...also you are using a web application, not a website correct?
Nick Craver