Last post Aug 13, 2009 10:22 AM by BGRhoades
Aug 12, 2009 01:01 PM|BGRhoades|LINK
First of all, I do not know if this post should be here or somwhere else. I've extended some controls and added custom methods and properties. I have a website project where I placed the files in the app_code folder, added the tag mapping to the web.config
and everything works fine. It gives a warning in the aspx page when setting the custom properties, but it compiles and the new properties and methods are accessible in the server code. I'm starting a new project and we have to move to a Web Application Project.
The App_Code folder does not exist for this project type and the tag mapping does not give me access to the new properties and methods. I've changed the Build Action on the file to Compile from Content and when I inspect the controls at runtime, it says the
control is the new control, but I still cannot access the new properties and methods in either the code or the immediate window. It does use the code I've altered for existing properties and methods. I was hoping to go with the tag mapping feature since all
the developers would not have to remember to add the custom control instead of the regular .Net controls. This is in VS 2005 Prof w/ only 2.0 framework installed. Any help would be appreciated.
Aug 13, 2009 10:22 AM|BGRhoades|LINK
I found the problem. The Web Application Project generates designer files which hold the declaration of the controls. The tool used to generate the files declares the controls as the standard control, which does not allow you to have access to the extended
controls custom properties or methods unless you cast the control. At runtime, the tagmapping is used so overridden properties and methods use the new code. So unless you are only overriding existing methods and properties, tagMapping is useless with a Web
Application Project and a Web Site project should be used instead.