VS2005: Add web controls through App_code

August 19, 2008

In VS2003, in order to add a webcontrol onto a page, the page would need the directive referencing the control to be used. In VS2005, there is a “trick” to get this work by modifying the web.config file. Add this section:

<system.web>
  <pages>
   <controls>
    <add tagPrefix=”ss” namespace=”DateControls” />
   </controls>
  </pages>

</system.web>

Once you have this, you can go to any of your pages and reference the control like so:

<ss:MonthDropDownList ID=”Month” runat=”server” />

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: