Question

I recently inherited a project that was done with the "web site project template" (which I hate by the way). I have always worked with the "web application template" which I love. I'm perplexed by something that I found in the project though. There is custom control instances throughout all the pages like this:

<cc1:MarketingItem runat="server" ID="BannerAd" />

Nothing too fancy there, right? What really irritates me is that it works just fine without any control registration tags at the top of any of the pages for "cc1" or code behind it's just magic! As you can imagine this makes tracking down the locations of these controls more work, and frankly a pain. My question is how is this even possible? And why did Microsoft introduce such an annoying inconsistency with this project template?

Was it helpful?

Solution

You'll likely find it registered in web.config (system.web>pages>controls i believe). You can globaly register controls there just as you would on the page.

<pages>
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </controls>
</pages>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top